73 properties['link_name'] = link_name |
73 properties['link_name'] = link_name |
74 properties['title'] = form.cleaned_data.get('title') |
74 properties['title'] = form.cleaned_data.get('title') |
75 properties['short_name'] = form.cleaned_data.get('short_name') |
75 properties['short_name'] = form.cleaned_data.get('short_name') |
76 properties['abstract'] = form.cleaned_data.get('abstract') |
76 properties['abstract'] = form.cleaned_data.get('abstract') |
77 properties['content'] = form.cleaned_data.get('content') |
77 properties['content'] = form.cleaned_data.get('content') |
78 properties['founder'] = models.user.logic.getFromFields(email=email) |
78 properties['author'] = models.user.logic.getFromFields(email=email) |
79 properties['is_featured'] = form.cleaned_data.get('is_featured') |
79 properties['is_featured'] = form.cleaned_data.get('is_featured') |
80 |
80 |
81 doc = document.logic.updateOrCreateFromFields(properties, |
81 doc = document.logic.updateOrCreateFromFields(properties, |
82 partial_path=partial_path, |
82 partial_path=partial_path, |
83 link_name=link_name) |
83 link_name=link_name) |
92 |
92 |
93 class Meta: |
93 class Meta: |
94 model = soc.models.document.Document |
94 model = soc.models.document.Document |
95 |
95 |
96 #: list of model fields which will *not* be gathered by the form |
96 #: list of model fields which will *not* be gathered by the form |
97 exclude = ['inheritance_line', 'founder', 'created', 'modified'] |
97 exclude = ['inheritance_line', 'author', 'created', 'modified'] |
98 |
98 |
99 def clean_partial_path(self): |
99 def clean_partial_path(self): |
100 partial_path = self.cleaned_data.get('partial_path') |
100 partial_path = self.cleaned_data.get('partial_path') |
101 # TODO(tlarsen): combine path and link_name and check for uniqueness |
101 # TODO(tlarsen): combine path and link_name and check for uniqueness |
102 return partial_path |
102 return partial_path |
238 helper.requests.getSingleIndexedParamValue( |
238 helper.requests.getSingleIndexedParamValue( |
239 request, profile.SUBMIT_MSG_PARAM_NAME, |
239 request, profile.SUBMIT_MSG_PARAM_NAME, |
240 values=SUBMIT_MESSAGES)) |
240 values=SUBMIT_MESSAGES)) |
241 |
241 |
242 # populate form with the existing Document entity |
242 # populate form with the existing Document entity |
243 founder_link_name = doc.founder.link_name |
243 author_link_name = doc.author.link_name |
244 form = EditForm(initial={'doc_key_name': doc.key().name(), |
244 form = EditForm(initial={'doc_key_name': doc.key().name(), |
245 'title': doc.title, 'partial_path': doc.partial_path, |
245 'title': doc.title, 'partial_path': doc.partial_path, |
246 'link_name': doc.link_name, 'short_name': doc.short_name, |
246 'link_name': doc.link_name, 'short_name': doc.short_name, |
247 'abstract': doc.abstract, 'content': doc.content, |
247 'abstract': doc.abstract, 'content': doc.content, |
248 'founder': doc.founder, 'is_featured': doc.is_featured, |
248 'author': doc.author, 'is_featured': doc.is_featured, |
249 'created_by': founder_link_name}) |
249 'created_by': author_link_name}) |
250 else: |
250 else: |
251 if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME): |
251 if request.GET.get(profile.SUBMIT_MSG_PARAM_NAME): |
252 # redirect to aggressively remove 'Profile saved' query parameter |
252 # redirect to aggressively remove 'Profile saved' query parameter |
253 return http.HttpResponseRedirect(request.path) |
253 return http.HttpResponseRedirect(request.path) |
254 |
254 |