About Archive Tag Cloud Translations RSS

You are writing a comment about Choosing Between AuditTrail and Django-Rcsfield, here is a quick summary:

Marty Alchin pointed me in the direction of AuditTrail, and it is a really excellent solution to versioning model data. So excellent, that after experimenting with both AuditTrail and django-rcsfield that I felt strongly compelled to go with AuditTrail despite already having a (mostly) working implementation with django-rcsfield.


You are responding to this comment written by Bartosz Ptaszynski on March 17th 2009, 07:20.

I believe this would be a better approach.

   class Wine(models.Model):
       title = models.CharField(max_length=100)
       
       def _get_description(self):
           return self.descriptions.latest("timestamp")
           
       def _set_description(self, description):
           rev = WineRevision(description=description, wine=self)
           rev.save()
           
       description = property(_get_description, _set_description)
   
   class WineRevision(models.Model):
       description = models.TextField()
       timestamp = models.DateTimeField(auto_now_add=True)
       wine = models.ForeignKey("Wine", related_name="descriptions")

Thanks for pointing out the revisioning libs! Haven't been aware of the django-rcsfield


Please be aware that comment forms go stale after one hour.





Comments may make use of LifeFlow MarkDown. Raw html will be escaped.


Quick Introduction to LifeFlow MarkDown Syntax

A highlighted code block:

@@ ruby
def a (b, c):
  b * c
end
@@

Other common languages work as well: scheme, python, java, html, etc.

Other markdown syntax:

 ### This is an h3 title
#### This is an h4 title
**this is bold**
*this is italics*

1. This is an
2. ordered list

* And an unordered
* list too

[this is a link](http://www.lethain.com/ "Lethain")