#34979: inlineformset_factory sets max_num forms to one even though there is a
unique_together constraint
-------------------------------+--------------------------------------
     Reporter:  Evan Hallein   |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  closed
    Component:  contrib.admin  |                  Version:  3.2
     Severity:  Normal         |               Resolution:  fixed
     Keywords:  inline admin   |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  1
-------------------------------+--------------------------------------
Changes (by Evan Hallein):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 fixed by changing the model to not use the onetoone as a primary key and
 instead have a separate primary key:

 {{{
 class TrtMeasurements(models.Model):
     id = models.AutoField(primary_key=True)
     observation = models.ForeignKey('TrtObservations',
 on_delete=models.CASCADE)
     measurement_type = models.ForeignKey(TrtMeasurementTypes,
 on_delete=models.CASCADE, db_column='measurement_type')
     measurement_value = models.FloatField()
     comments = models.TextField(blank=True, null=True)

     class Meta:
         managed = False
         db_table = 'trt_measurements'
         unique_together = (('observation', 'measurement_type'),)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34979#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018bead7ff4e-0ecdc5e5-01d5-45e7-b4a3-e96f34c708b5-000000%40eu-central-1.amazonses.com.

Reply via email to