Tuesday, August 23, 2011

Custom Validation on Inline Generic Foreign Key

Hi there,

I am writing an app with Django where I have a model with a generic
foreign key. I
am looking to do some validation on this model based on the
content_type of the
generic foreign key. When I am modifying this model on its admin page,
I am
able to easily determine the content_type because it is in the form
data. Then I
can do a 'switch' on the content type to perform the correct
validations.

When I use the Model with the generic foreign key inline in another
model, I
can't seem to find the content_type or content_id in the form data. I
would expect
there is a way to get that models content_type from within the inline
model's form.

So am I missing something here, or is there a better way to approach
this problem?

Thanks is advance.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate