Dnia 11-03-2011 o 21:29:29 greenie2600 <[email protected]> napisał(a):
bagheera -
I had seen the limit_choices_to parameter, but I thought it controlled
*which* choices are available to the user - not *how many* they're
allowed to choose.
I want to show the user a list of 20 or 30 cuisines, but forbid them
from checking more than three.
Can you show me an example of how I'd use limit_choices_to to limit
the *number* of choices the user can select?
On Mar 11, 2:35 pm, bagheera <[email protected]> wrote:
Dnia 11-03-2011 o 18:06:43 greenie2600 <[email protected]>
napisał(a):
> Hi all -
> I have two models with a many-to-many relationship: Restaurant and
> Cuisine. The Cuisine table contains, e.g., "Italian", "Mexican",
> "Chinese", etc. Each Restaurant record can be associated with one or
> more Cuisines.
> Here's the thing: I'd like to limit this to three Cuisines per
> Restaurant. So when editing the record for "Bob's Pan-Asian Buffet",
> the user would be able to check "Japanese", "Chinese", and "Korean",
> but wouldn't be able to check a fourth box.
> My question: can this be enforced within the model, or is this
> something I'd have to build into my interface layer?
or u can add a js script to this form field that will disallow selecting
more than three items instead validating model (or do both).
--
Linux user
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to [email protected].
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.