Changes between Version 6 and Version 7 of FullHistory
- Timestamp:
- Aug 21, 2006, 5:27:18 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
FullHistory
v6 v7 3 3 4 4 == Current status == 5 '''Features: getting there''' (8.08.2006)5 '''Features: almost there''' (21.08.2006) 6 6 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. 7 At 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.''' 8 12 9 13 === Get the code === … … 17 21 18 22 ||'''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)|| 21 27 ||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) || 25 29 26 30 … … 46 50 title = models.CharField(maxlength=100) 47 51 content = models.TextField() 48 date = models. dateField()52 date = models.DateField(auto_now=True) 49 53 50 54 class History: … … 52 56 }}} 53 57 54 When this is done every "Post" object will be saved to a " appname_history" table when created, changed or deleted.58 When this is done every "Post" object will be saved to a "django_history_log" table when created, changed or deleted. 55 59 56 === API (not working at the moment)===60 === API === 57 61 For this functionality to be really usefull I need to create some listing, reverting and other functions. 58 62 59 '''List ingall revisions of an object:'''63 '''List of all revisions of an object:''' 60 64 {{{ 61 65 #!python 62 rev_list = poll1.revisions.all() 66 from django.contrib.history.models import ChangeLog 67 68 post = Post(author="Mort", title="Discworld is down!", content="Well, it's rather complicated...") 69 post.save() 70 71 rev_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 77 rev_list = ChangeLog.objects.list_history(post, offset=3) # Returns a list of latest 3 versions for this object 63 78 }}} 64 79 … … 66 81 {{{ 67 82 #!python 68 rev_list = poll1.revisions.by_date(datetime(2006, 07, 08))83 rev_list = ChangeLog.objects.version_by_date(post, datetime(2006, 07, 08)) 69 84 }}} 70 85 … … 72 87 {{{ 73 88 #!python 74 rev_list = poll1.revisions.get(offset=3)89 rev_list = ChangeLog.objects.get_version(post, offset=3) 75 90 }}} 76 91 … … 78 93 {{{ 79 94 #!python 80 rev_list = poll1.revisions.get(id=222)95 rev_list = ChangeLog.objects.get_version(poll, revision=222) 81 96 }}} 82 97 … … 84 99 {{{ 85 100 #!python 86 poll1 = poll1.revisions.revert_to(id=222) 101 # NOT IMPLEMENTED!!! User should do the mreging, comparing and reverting manualy. 87 102 }}} 88 103