New to django - trying to get smart_selects working but the dropdown fields don't seem to be populating on the form.
I've trawled the web for answers and read the few similar questions on stackoverflow but none suggest a working answer for the smart_selects app.
My data model: multiple catalogues in a DMU, and multiple DMUs in a single survey. Currently the Survey select is populated but the DMU and catalogue options are not. Any help would be much appreciated.
model.py
class Survey(models.Model):
survey = models.CharField(max_length=40, default='GAMA')
def __str__(self):
return self.survey
class DMU(models.Model):
dmu = models.CharField(max_length=40, default='GroupFinding')
survey = models.ForeignKey(Survey)
CHOICES=(
('sm', 'stellarmasses'),
('gf', 'groupfinding'),
)
def __str__(self):
return self.dmu
class Catalogue(models.Model):
catalogue = models.CharField(max_length=40, default='GalG3C')
dmu = models.ForeignKey(DMU)
def __str__(self):
return self.catalogue
class allData(models.Model):
catalogue = models.ForeignKey(Catalogue)
dmu = ChainedForeignKey(DMU, chained_field='catalogue', chained_model_field='catalogue', auto_choose=True)
survey = ChainedForeignKey(Survey, chained_field='dmu', chained_model_field='dmu', auto_choose=True)
def __str__(self):
return '%s %s %s' % (self.survey, self.dmu, self.catalogue)
forms.py
class ASVOForm(forms.ModelForm):
class Meta:
model=allData
fields = '__all__'