def save(self): self.save_tags() if 'only_tags' not in self.data.keys(): self.save_state() if settings.USE_DB_REDESIGN_PROXY_CLASSES: comment = self.cleaned_data.get('comment').strip() if comment: e = DocEvent(type="added_comment") e.time = datetime.datetime.now() e.by = self.person e.doc_id = self.draft.pk e.desc = comment e.save()
def save(self): comment = self.cleaned_data.get('comment').strip() weeks = self.cleaned_data.get('weeks') group = IETFWG.objects.get(pk=self.cleaned_data.get('group')) estimated_date = None if weeks: now = datetime.date.today() estimated_date = now + datetime.timedelta(weeks=weeks) if settings.USE_DB_REDESIGN_PROXY_CLASSES: # do changes on real Document object instead of proxy to avoid trouble doc = Document.objects.get(pk=self.draft.pk) save_document_in_history(doc) doc.time = datetime.datetime.now() if group.type.slug == "rg": new_stream = StreamName.objects.get(slug="irtf") else: new_stream = StreamName.objects.get(slug="ietf") if doc.stream != new_stream: e = DocEvent(type="changed_stream") e.time = doc.time e.by = self.user.get_profile() e.doc = doc e.desc = u"Changed to <b>%s</b>" % new_stream.name if doc.stream: e.desc += u" from %s" % doc.stream.name e.save() doc.stream = new_stream if doc.group.pk != group.pk: e = DocEvent(type="changed_group") e.time = doc.time e.by = self.user.get_profile() e.doc = doc e.desc = u"Changed group to <b>%s (%s)</b>" % ( group.name, group.acronym.upper()) if doc.group.type_id != "individ": e.desc += " from %s (%s)" % (doc.group.name, doc.group.acronym) e.save() doc.group_id = group.pk doc.save() self.draft = InternetDraft.objects.get( pk=doc.pk) # make sure proxy object is updated else: workflow = get_workflow_for_wg(wg) set_workflow_for_object(self.draft, workflow) stream = get_stream_by_name(IETF_STREAM) streamed = get_streamed_draft(self.draft) if not streamed: set_stream_for_draft(self.draft, stream) streamed = get_streamed_draft(self.draft) streamed.stream = stream streamed.group = wg streamed.save() if settings.USE_DB_REDESIGN_PROXY_CLASSES: from ietf.doc.models import State if self.draft.stream_id == "irtf": to_state = State.objects.get(used=True, slug="active", type="draft-stream-irtf") else: to_state = State.objects.get(used=True, slug="c-adopt", type="draft-stream-%s" % self.draft.stream_id) else: to_state = get_state_by_name(CALL_FOR_ADOPTION) update_state(self.request, self.draft, comment=comment, person=self.person, to_state=to_state, estimated_date=estimated_date) if settings.USE_DB_REDESIGN_PROXY_CLASSES: if comment: e = DocEvent(type="added_comment") e.time = self.draft.time e.by = self.person e.doc_id = self.draft.pk e.desc = comment e.save()
def save(self): comment = self.cleaned_data.get('comment').strip() weeks = self.cleaned_data.get('weeks') group = IETFWG.objects.get(pk=self.cleaned_data.get('group')) estimated_date = None if weeks: now = datetime.date.today() estimated_date = now + datetime.timedelta(weeks=weeks) if settings.USE_DB_REDESIGN_PROXY_CLASSES: # do changes on real Document object instead of proxy to avoid trouble doc = Document.objects.get(pk=self.draft.pk) save_document_in_history(doc) doc.time = datetime.datetime.now() if group.type.slug == "rg": new_stream = StreamName.objects.get(slug="irtf") else: new_stream = StreamName.objects.get(slug="ietf") if doc.stream != new_stream: e = DocEvent(type="changed_stream") e.time = doc.time e.by = self.user.get_profile() e.doc = doc e.desc = u"Changed to <b>%s</b>" % new_stream.name if doc.stream: e.desc += u" from %s" % doc.stream.name e.save() doc.stream = new_stream if doc.group.pk != group.pk: e = DocEvent(type="changed_group") e.time = doc.time e.by = self.user.get_profile() e.doc = doc e.desc = u"Changed group to <b>%s (%s)</b>" % (group.name, group.acronym.upper()) if doc.group.type_id != "individ": e.desc += " from %s (%s)" % (doc.group.name, doc.group.acronym) e.save() doc.group_id = group.pk doc.save() self.draft = InternetDraft.objects.get(pk=doc.pk) # make sure proxy object is updated else: workflow = get_workflow_for_wg(wg) set_workflow_for_object(self.draft, workflow) stream = get_stream_by_name(IETF_STREAM) streamed = get_streamed_draft(self.draft) if not streamed: set_stream_for_draft(self.draft, stream) streamed = get_streamed_draft(self.draft) streamed.stream = stream streamed.group = wg streamed.save() if settings.USE_DB_REDESIGN_PROXY_CLASSES: from ietf.doc.models import State if self.draft.stream_id == "irtf": to_state = State.objects.get(used=True, slug="active", type="draft-stream-irtf") else: to_state = State.objects.get(used=True, slug="c-adopt", type="draft-stream-%s" % self.draft.stream_id) else: to_state = get_state_by_name(CALL_FOR_ADOPTION) update_state(self.request, self.draft, comment=comment, person=self.person, to_state=to_state, estimated_date=estimated_date) if settings.USE_DB_REDESIGN_PROXY_CLASSES: if comment: e = DocEvent(type="added_comment") e.time = self.draft.time e.by = self.person e.doc_id = self.draft.pk e.desc = comment e.save()