Hi Arnold,
Am 15.11.2012 17:52, schrieb Arnold Krille:
On Thursday 15 November 2012 17:12:09 Carsten Fuchs wrote:
[...]
(Note that it is not enough to consider the Period that changed --
rather, it is the 'end' in *another* period (the one "before" it) that
must be modified and saved, too.)
What is the proper hook or where the best place to do this?
Why do you want to do this only in the admin interface?
Its a generic thing: every time you save/change a period you should set the
end-date of the previous one. So I would do this with a post-save hook (aka
signal) directly in the models.py. Or maybe even subclass your models save-
operation.
Well, I realize that this would be useful also generically, outside of
the admin interface.
Alas, if e.g. I overrode the save() method of the Period class, is it
safe to access *another* Period instance from there?
I don't really fully understand how the admin interface works when a
model with inlines is saved, but I suspect that the inlines are saved in
a loop. But if in an early iteration of the loop I modified another
instance that is routinely saved *again* in a later iteration of the
loop, it will be a bug.
Thus my original question. ;-)
Best regards,
Carsten
--
Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
Learn more at http://www.cafu.de
--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.