Commits

Paul Fox committed 00f6ad0

Record the author of a revision properly.

  • Participants
  • Parent commits 0c1efd8

Comments (0)

Files changed (2)

File hyaku_wiki/models.py

     content = models.TextField()
 
     def __unicode__(self):
-        return self.article.name + ' ' + self.created.isoformat(' ') 
+        return self.created.isoformat(' ') + ' ' + str(self.author)
     
 class Article(models.Model, Versioned):
     name = models.CharField(max_length=256, unique=True)

File hyaku_wiki/views.py

             # Create the new revision from cleaned form data
             if form.diff is None or not len(form.diff) == 0:
                 article.save()
-                new = ArticleRevision(article=article, content=form.cleaned_data['content'])     
+                new = ArticleRevision(article=article, content=form.cleaned_data['content'], author=request.user)     
                 new.save()
             return HttpResponseRedirect('../../%s/' % name)
         else:
     """ Views the revision history for a given article."""
     article = Article.objects.get(name__iexact=name)
     revisions = ArticleRevision.objects.filter(article=article).order_by('-created')
-    revisions = [i.created for i in revisions]
+    revisions = [i.created.strftime('%B %d, %Y %H:%M:%S') + '\t' + str(i.author) for i in revisions]
 
     return render(request, 'wiki/history.html', {'revisions':revisions,\
         'name':name})