Django Form: Manytomany Inline Creation
I would like to be able to let users create locations 'on-the-fly' when they create a report. Using the following models if possible. models: class Report(models.Model): ...
Solution 1:
For create "on-the-fly" I had changed ManyToMany by ForeingKey.
classReport(models.Model):
...
location = forms.ManyToManyField(Location) # REMOVE
classLocation(models.Model):
report = models.ForeignKey(Report) # ADD
name = forms.CharField(max_length=255)
...
And then, InlineForms will work.
Post a Comment for "Django Form: Manytomany Inline Creation"