Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Inline Formset Validation
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
KRH  
View profile  
 More options Jul 2, 3:29 pm
From: KRH <imd.mediagene...@gmail.com>
Date: Thu, 2 Jul 2009 12:29:30 -0700 (PDT)
Local: Thurs, Jul 2 2009 3:29 pm
Subject: Inline Formset Validation
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google