On Fri, 2007-05-04 at 15:00 -0700, Casey T. Deccio wrote:
> I'd like to be able to do some further validation in a form, based on
> the instance object from which the form was built (i.e., using
> form_from_instace).  This would be handy for either populating fields
> (i.e., for an extended form class) using the instance or for validation
> after the form has been submitted, based on previous information.  Is
> there a good way to do this?  Would it be appropriate to modify
> form_for_instance to include an 'instance' attribute in the returned
> class (or something similar)?

You could include the instance's primary key value in the form so that
you could retrieve it later. Although, remember that the person
submitting the form could change that value (even if it's a hidden
field), so you may wish to encrypt it in some fashion before including
it.

Part of your requirements -- validation based on existing information --
are something we want to implement as what we are calling "model-aware
validation", whereby models can do validation based on their current
contents and knowledge of "self". It isn't really implemented (or even
fully specified) yet, but it's something I want to look at before 1.0.

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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to