Re: Referencing objects that don't exist that will be created in forms

2017-10-19 Thread Chris Wedgwood
Hi All Ive overcome it by adding doing this: def __init__(self, *args, **kwargs): super(UniversityForm, self).__init__(*args, **kwargs) self.fields['name'].choices = University.objects.values_list('id', 'name') This makes sense. Don't reference objects that will be parsed before they e

Referencing objects that don't exist that will be created in forms

2017-10-19 Thread Chris Wedgwood
Hi I have the following scenario in my forms.py: UNIVERSITY_CHOICES = University.objects.values_list('id', 'name') class UniversityForm(forms.Form): name = forms.CharField(widget=forms.Select(attrs={"class": "selectpicker", "data-live-search": "true","title": "find university..."},choices=UN