On 6/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Thanks... that does look like what I'm looking for. I don't really
> understand how I'd put it in a model, though... I've got a situation
> where if the choose a, they need to choose from one list, if they
> choose b, they need to choose from another, and so on, but this is all
> in the admin.. no public form.
Instantiate RequiedIfOtherFieldEquals, and put it in the
validator_list argument of your optional fields. Something similar to
this should work:
class MyModel(models.Model):
required_field = models.CharField()
opt_field_a = models.IntegerField(
choices=C1,
validator_list=[RequiedIfOtherFieldEquals('required_field', 'a')]
)
opt_field_b = models.IntegerField(
choices=C2,
validator_list=[RequiedIfOtherFieldEquals('required_field', 'b')]
)
Joseph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---