On Tue, 2006-07-04 at 09:19 +0200, toth anna wrote:
> I asked you before about how to implement "cointainer level
> logic" in django.
> You suggested me to override save() method (example was:
> object can decide from the "fields" to create more "records"
> instead just saving oneself). It worked well, but...
> What do you suggest if i have to interact with user
> meanwhile? (Asking him/her to confirm procedure)
> Is it possible to encapsulate into object's (i know, there
> is no container) logic?

Models (your objects) are normally not dependent on views in Django, so
the logic to automatically get authorisation would be at the view level,
not inside the model. If you wanted to have a multi-stage confirmation
process you would need a view that takes the first block of data for
creating the objects and generates the confirmation page.

You could, between pages, create a temporary object somewhere (although
how will you know when to delete it? Maybe a periodic cronjob to clean
up temporaries?), or put the necessary data into the user's session.
Putting the data into hidden form variables is also possible, although
then you would need to handle the possibility of the user changing the
values before resubmitting the form.

If you have a look in django/contrib/admin/views/main.py in the
delete_stage() method, you can see how Django's admin stage handles
getting delete confirmation from the user before going ahead. That might
give you an example to work with.

Regards,
Malcolm




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to