A question on forms; I had asked something similar on StackOverflow but found the solution didn't really work for me. Let's say I have an Article class and a Photo class, and I want to be able to attach Photos to Articles. I create an ArticlePhotoSet class, and make it an InlineForm in the Article's Admin class. Here's the problem:
Articles can be assigned to a site, and Photos can be assigned to a site. Each time an Article is saved in the admin, the form needs to throw an error if any of the Photos pointed to by the ArticlePhotoSet inlines don't belong to the same site(s) that the Article does. The problem is that in the ArticlePhotoSet formset, self.instance in the clean() function refers to what is currently saved for the article, not what the Article form is 'proposing' the new site be in the form. So any check placed in the ArticlePhotoSet formset clean() is referring to what the site value is, not what it will be. Conversely, the formset doesn't seem to be accessible from the cleaning method of the Article form itself, so the Article's form can't do the check. Is there a way to do what I'm trying to accomplish without falling back onto something more extreme like AJAX checks when the Article's site value is changed on the form? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---