> There's quite a learning curve here.

The learning curve doesn't have much to do with Django, but 
rather development in general -- any time you take on a new 
technology (or soup of technologies, in this case Python/HTML/CSS 
Django's templating language, and possibly SQL) there's a hill to 
climb, but this one's pretty gentle -- in fact the most gentle 
learning curve of all the frameworks I've toyed with.  Django 
feels very much like just more Python instead of a 
cobbled-together pile of disparate parts (a ding against some of 
the frameworks like CherryPy and friends).

Ruby+Rails isn't bad on the "cohesive" aspect, but I can't stand 
the language (same goes for Perl, but with less mature 
frameworks); PHP has a smattering of frameworks such as Cake, but 
I don't care for PHP as a language (I use PHP for some jobs, but 
I wouldn't want to maintain anything sizable); and the Play 
framework for Java sounds promising-but-nascent (as a language, 
Java is tolerable, but not great).

Back to the topic on hand, there are several ways to do 
model-versioning.  I'm partial to having a FooHistory table that 
mirrors the parent table's fields but has a timestamp associated 
with it.  The most recent one is always the Foo object, but 
before a Foo is saved, the current state is archived off to the 
FooHistory table with the archiving timestamp.  Since most of the 
most recent item is the one of interest, having that easily 
accessible makes my life easier.  If I want the whole history, I 
just do something like

   results = itertools.chain([
      Foo.objects.filter(id=x),
      FooHistory.objects.filter(original_id=x)
      ])
or
   results = [Foo.objects.get(id=x)] + \
      list(FooHistory.objects.filter(original_id=x))

in my view.

-tim






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to