Hello everyone,

I have a form field that is pulling choices from the database:

class FooJBossForm(Form):
    biz_service = MultipleChoiceField(
        choices=BizService.objects.filter(
            biz_unit__bu_name='Foo',
        ).order_by('bs_name').values_list('bs_name', 'bs_name').distinct(),
        required=False,
        label='Business Service',
        widget=SelectMultiple(attrs={'class': 'form-control'}),
    )

    ...

This worked great until someone else on my team attempted to start with a 
fresh DB and was getting "relation does not exist" errors trying to do the 
initial import.

Commenting out these "choices=" parameters in `forms.py` fixes the issue.  
What's the right way to go about populating form field choices from the DB 
at access time?

Thanks,

j



-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a13f34ed-c8e9-4a92-829b-207e8eff4cf5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to