Re: Custom Validation on Inline Generic Foreign Key
I went ahead and hardcoded checks for fields that as of today I know will only be in one of the models. I would still love to hear any cleaner solutions if anyone has them. On Aug 26, 10:12 am, Johnwrote: > Any ideas? > > In the inline model's validation I could hardcode checks for data that > I expect will only be in one of the models, but that does not seem > like the best option. I am still hoping for a simpler alternative to > this. > > Thanks. -- 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.
Re: Custom Validation on Inline Generic Foreign Key
Any ideas? In the inline model's validation I could hardcode checks for data that I expect will only be in one of the models, but that does not seem like the best option. I am still hoping for a simpler alternative to this. Thanks. -- 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.
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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.