def save(self, *args, **kwargs): # save both forms profile = self.profileForm.save(commit=False) """ Ensure we create a revision for reversion. """ person = super(PersonForm, self).save(commit=False) # Ensure we make an initial revision with transaction.atomic(): with revision_context_manager.create_revision(): profile.save() person.profile = profile person.save() self.save_m2m() if self.user: revision_context_manager.set_user(self.user) object_repr = build_obj_repr(person) + build_obj_repr(profile) translation_info = get_translation_info_message(person) revision_context_manager.set_comment( ugettext( "Initial version of {object_repr}. {trans_info}".format( object_repr=object_repr, trans_info=translation_info))) return person
def save(self, commit=True): """ Ensure we create a revision for reversion. """ person = super(CreatePeoplePersonForm, self).save(commit=False) # Ensure we make an initial revision with transaction.atomic(): with revision_context_manager.create_revision(): person.save() self.save_m2m() if self.user: revision_context_manager.set_user(self.user) object_repr = build_obj_repr(person) translation_info = get_translation_info_message(person) revision_context_manager.set_comment( ugettext("Initial version of {object_repr}. {trans_info}". format(object_repr=object_repr, trans_info=translation_info))) return person
def save(self, commit=True): """ Ensure we create a revision for reversion. """ person = super(CreatePeoplePersonForm, self).save(commit=False) # Ensure we make an initial revision with transaction.atomic(): with revision_context_manager.create_revision(): person.save() self.save_m2m() if self.user: revision_context_manager.set_user(self.user) object_repr = build_obj_repr(person) translation_info = get_translation_info_message(person) revision_context_manager.set_comment( ugettext( "Initial version of {object_repr}. {trans_info}".format( object_repr=object_repr, trans_info=translation_info))) return person