Ignore:
Timestamp:
Aug 13, 2011, 9:53:10 PM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage, test-hooks
Children:
0bd161f
Parents:
9bf5237
git-author:
Alex Dehnert <adehnert@…> (08/13/11 21:53:10)
git-committer:
Alex Dehnert <adehnert@…> (08/13/11 21:53:10)
Message:

Fix updater information

Systems updating entries should call set_updater with the updater (as a string
or request.user object) in order to ensure that the updater is correct.
Otherwise, it will be unset on instance.save(). Regardless, the update_time
will be updated.

This mechanism is independent of django-reversion's history functionality,
which also stores the updater.

Note, in particular, that the admin does not currently use this interface
to store the updater, but does store it in django-reversion's system (along
with the rest of the history). Porting the "view group" page over may be
desirable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/views.py

    r70f2dd3 raa6a940  
    7878    ]
    7979    nobody_fields = [
    80         'recognition_date', 'updater', 'update_date',
     80        'recognition_date',
    8181    ]
    8282
     
    105105            ('more-info', {
    106106                'legend': 'Additional Information',
    107                 'fields': ['constitution_url', 'advisor_name', 'athena_locker', 'updater', 'update_date', ],
     107                'fields': ['constitution_url', 'advisor_name', 'athena_locker', ],
    108108            }),
    109109        ]
     
    131131
    132132        if form.is_valid(): # All validation rules pass
    133             request_obj = form.save()
     133            request_obj = form.save(commit=False)
     134            request_obj.set_updater(request.user)
     135            request_obj.save()
     136            form.save_m2m()
    134137
    135138            # Send email
Note: See TracChangeset for help on using the changeset viewer.