Changes between Initial Version and Version 1 of FullHistory


Ignore:
Timestamp:
Jul 15, 2006, 8:43:44 AM (18 years ago)
Author:
uros.trebec@…
Comment:

Initial description of the project

Legend:

Unmodified
Added
Removed
Modified
  • FullHistory

    v1 v1  
     1== Current status ==
     2'''Feature incomplete!''' (15.07.2006)
     3
     4At this stage none of the samples below work. Code is experimental and does not work. This status will change as soon as I get the API and the generic functions working.
     5
     6=== Get the code ===
     7You can grab the current code from the "full-history" branch:
     8{{{
     9svn co http://code.djangoproject.com/svn/django/branches/full-history/
     10}}}
     11
     12=== TODO ===
     13This is a general list of tasks, details are managed in a Basecamp project. If you want access drop me an email at urosDOTtrebecATgmailDOTcom.
     14
     15||Getting the code to work genericaly (on every given model)||
     16||Getting the API to work as described below||
     17||Getting the code to a working state||
     18
     19== Introduction ==
     20=== The problem ===
     21The changelog-type of history in its current implementation, would write log only when using Admin and log would include only information about the change but not the content that was changed. This is not very usefull when you would like to revert a change or even see what whas changed.
     22
     23=== The main idea ===
     24I am trying to write a different implemetation that will be independent of Admin and will store the content as well. This way developers will be able to save, compare and revert any changes made in any particular model.
     25
     26== Usage ==
     27=== Models ===
     28How to enable history tracking?
     29Enablig history tracking for a particural model is just like adding Admin functionality - add an inner class as shown below:
     30
     31{{{
     32#!python
     33class Post(models.Model):
     34    author = models.CharField(maxlength=100)
     35    title = models.CharField(maxlength=100)
     36    content = models.TextField()
     37    date = models.dateField()
     38
     39    class History:
     40        pass
     41}}}
     42
     43When this is done every "Post" object will be saved to a "appname_history" table when created, changed or deleted. 
     44
     45=== API ===
     46For this functionality to be really usefull I need to create some listing, reverting and other functions.
     47
     48'''Listing all revisions of an object:'''
     49{{{
     50#!python
     51rev_list = poll1.revisions.all()
     52}}}
     53
     54'''Get a date-specific list of revisions:'''
     55{{{
     56#!python
     57rev_list = poll1.revisions.by_date(datetime(2006, 07, 08))
     58}}}
     59
     60'''Get a revision that is 3 revisions back:'''
     61{{{
     62#!python
     63rev_list = poll1.revisions.get(offset=3)
     64}}}
     65
     66'''Get a specific revision (for example, 222):'''
     67{{{
     68#!python
     69rev_list = poll1.revisions.get(id=222)
     70}}}
     71
     72'''Revert to a specific revision:'''
     73{{{
     74#!python
     75poll1 = poll1.revisions.revert_to(id=222)
     76}}}
Back to Top