def apply(self): original_content = self.file.content # store the old content on the file self.file.content = self.get_file_content() self.file.save() # mark reverted changesets reverted_qs = self.file.revisions.filter( revision_number__gt=self.revision_number) reverted_qs.update(is_reverted=True) # create a new revision FileRevision.objects.create( file=self.file, comment='Reverted to #%s' % self.revision_number, diff=diff(self.file.content, original_content))
def apply(self): original_content = self.file.content # store the old content on the file self.file.content = self.get_file_content() self.file.save() # mark reverted changesets reverted_qs = self.file.revisions.filter(revision_number__gt=self.revision_number) reverted_qs.update(is_reverted=True) # create a new revision FileRevision.objects.create( file=self.file, comment='Reverted to #%s' % self.revision_number, diff=diff(self.file.content, original_content) )
def create_revision(self, old_content, comment): FileRevision.objects.create( file=self, comment=comment, diff=diff(self.content, old_content) )
def create_revision(self, old_content, comment): FileRevision.objects.create(file=self, comment=comment, diff=diff(self.content, old_content))