> I'm not sure I really understand.  It sort of sounds like you are
> talking about a CharField with a choices argument.  Is what you're
> looking for more complex?

No...a "choices" argument assumes you know what you want in the 
field beforehand...yes, I'm looking for a headache :)

> Can you describe it in more detail?

It would be like a TextField that behaves like the contents of an 
RCS ",v" file.  As the item is saved, past revisions are 
maintained and only deltas are applied.  Past revisions can be 
extracted.  Much like your average wiki edit-field.

Theoretically, one could bind to an existing library like the 
"bzr" revision-control libraries (graciously already written in 
Python), mercurial/hg (also written mostly in python), SVN or CVS 
(providing python interfaces, but to non-Django-DB backend 
storage from my understanding)  and hook into their ability to 
manage the content as revisions.  Even a "rcs.py" or something 
like that would be sufficient as long as it could work with a 
string-object rather than having to marshall files.

Such fields would have ways of extracting various revisions and 
differences between revisions.

Sample usage of this imaginary field type (adjust for 
apropriateness):


class Foo(Model):
   title = CharField(maxlength=42)
   body = RevisionControlField()


 >>> f = Foo.objects.create(title='This is a test', body="""
...   line 1
...   Hello world
...   line 3
...   """)
...
 >>> f.save()
 >>> f.body = """
...   line 1
...   Goodbye world
...   line 3
...   """)
 >>> f.save()
 >>> f.body = """
...   line 1
...   Aloha world
...   line 3
...   """)
 >>> f.body.diff()
[output showing "Goodbye" -> "Aloha" in your favorite diff 
format, or perhaps a "diff" object]
 >>> f.body.diff(1) #diff with
[output showing "Hello" -> "Aloha" in your favorite diff format, 
or perhaps a "diff" object]
 >>> f.body.revert() # now back at version 2 with "Goodbye"
 >>> f.body[1]
"""  line 1
   Hello world
   line 3
   """
 >>> f.body.revisions
2




Hope this clarifies what I'm hunting for.  Thanks though!

-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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to