Changes between Version 6 and Version 7 of FullHistory


Ignore:
Timestamp:
Aug 21, 2006, 5:27:18 PM (18 years ago)
Author:
utrebe
Comment:

A lot of changes due to SoC end

Legend:

Unmodified
Added
Removed
Modified
  • FullHistory

    v6 v7  
    33
    44== Current status ==
    5 '''Features: getting there''' (8.08.2006)
     5'''Features: almost there''' (21.08.2006)
    66
    7 At 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.
     7At the moment the contrib.history is quite usefull. Examples below should work.
     8
     9'''NOTE: Comparing and merging should be done by user and is not automated (yet).'''
     10
     11'''WARNING!!! Names of functions may change. Please check this page for any changes.'''
    812
    913=== Get the code ===
     
    1721
    1822||'''Task'''||'''Status'''||
    19 ||Getting the code to work genericaly (on every given model)||DONE||
    20 ||Getting the code to a working state||DONE||
     23||Getting the code to work genericaly (on every given model)||'''DONE'''||
     24||Getting the code to a working state||'''DONE'''||
     25||Getting the API to work as described below||'''DONE'''||
     26||Unit tests||(under way)||
    2127||Author handling (default Anonymous)|| ||
    22 ||Unit tests|| ||
    23 ||Getting the API to work as described below|| ||
    24 ||Admin UI integration|| ||
     28||Admin UI integration||(later) ||
    2529
    2630
     
    4650    title = models.CharField(maxlength=100)
    4751    content = models.TextField()
    48     date = models.dateField()
     52    date = models.DateField(auto_now=True)
    4953
    5054    class History:
     
    5256}}}
    5357
    54 When this is done every "Post" object will be saved to a "appname_history" table when created, changed or deleted.
     58When this is done every "Post" object will be saved to a "django_history_log" table when created, changed or deleted.
    5559
    56 === API (not working at the moment) ===
     60=== API ===
    5761For this functionality to be really usefull I need to create some listing, reverting and other functions.
    5862
    59 '''Listing all revisions of an object:'''
     63'''List of all revisions of an object:'''
    6064{{{
    6165#!python
    62 rev_list = poll1.revisions.all()
     66from django.contrib.history.models import ChangeLog
     67
     68post = Post(author="Mort", title="Discworld is down!", content="Well, it's rather complicated...")
     69post.save()
     70
     71rev_list = ChangeLog.objects.list_history(post) # Returns a complete list of versions for this object
     72}}}
     73
     74'''List of latest 3 revisions of an object:'''
     75{{{
     76#!python
     77rev_list = ChangeLog.objects.list_history(post, offset=3) # Returns a list of latest 3 versions for this object
    6378}}}
    6479
     
    6681{{{
    6782#!python
    68 rev_list = poll1.revisions.by_date(datetime(2006, 07, 08))
     83rev_list = ChangeLog.objects.version_by_date(post, datetime(2006, 07, 08))
    6984}}}
    7085
     
    7287{{{
    7388#!python
    74 rev_list = poll1.revisions.get(offset=3)
     89rev_list = ChangeLog.objects.get_version(post, offset=3)
    7590}}}
    7691
     
    7893{{{
    7994#!python
    80 rev_list = poll1.revisions.get(id=222)
     95rev_list = ChangeLog.objects.get_version(poll, revision=222)
    8196}}}
    8297
     
    8499{{{
    85100#!python
    86 poll1 = poll1.revisions.revert_to(id=222)
     101# NOT IMPLEMENTED!!! User should do the mreging, comparing and reverting manualy.
    87102}}}
    88103
Back to Top