On Wed, May 8, 2013 at 6:43 PM, noodlygod <[email protected]> wrote:

> <Character Name (Text field)>
> <Race (Select box - Definition.objects.filter(category__label='Race'))>
> <Race (Select box - Definition.objects.filter(category__label='Class'))><
> Class Level (Text field)>
> <Race (Select box -
> Definition.objects.filter(category__label='Skill'))><Skill Rank (Text
> field)>
> <Race (Select box -
> Definition.objects.filter(category__label=Attribute'))>< Attribute score
> (Text field)>
>
> I was on my way to creating a fully custom form in templates but that
> doesn't seem very django-y. I also discovered the queryset component in
> Select fields. I feel like there should be a way to do this and it may be
> simple but I've thought myself into a tangled mess. Any help would be
> appreciated. Thanks!
>

Isn't a ModelChoiceField[0] what you need? Just customize the queryset
attribute to restrict the available choices. My django-fu is a little
rusty, but IIRC you can define fields at runtime by subclassing __init__
and extending self.fields, which is a dict.


Cheers,
AT

[0] https://docs.djangoproject.com/en/dev/ref/forms/fields/#modelchoicefield

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to