#1578 closed enhancement (fixed)
[patch] validation for missing core=True in ForeignKey relations wrong
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Template system | Version: | |
Severity: | major | Keywords: | validation edit_inline |
Cc: | malcolm@… | Triage Stage: | Unreviewed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you have a Foreign Key relation with edit_inline=False, manage.py validate complains if you don't have a core=True in the related model, like this:
email.nextrech: At least one field in Nextrech should have core=True, because it's being edited inline by tarifkunde.Tarifkunde.
It shouldn't: No edit_inline, no core=True needed.
The original version of get_validation_error did not check edit_inline at all, that was the whole problem.
Attachments (1)
Change History (7)
by , 19 years ago
Attachment: | validate-edit-inline.diff added |
---|
comment:1 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
This has been fixed at some point since it was filed. The error is only raised if edit_inline = True.
comment:2 by , 18 years ago
Cc: | added |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Nope.
I get this message:
popkern.nextrech: At least one field in Nextrech should have core=True, because it's being edited inline by tarifkunde.Tarifkunde.
With these models:
class Nextrech(models.Model): id = models.IntegerField(primary_key=True) tarifkunde = models.ForeignKey(Tarifkunde, db_column='tarifkunde', related_name='nextrech_entry') knextrech = models.ForeignKey(Knextrech, db_column='knextrech') wann = models.IntegerField() beginn = models.IntegerField() ende = models.IntegerField() anzahl = models.IntegerField() timestamp = models.DateTimeField() class Meta: db_table = 'nextrech' class Tarifkunde(models.Model): id = models.IntegerField(primary_key=True) kunde = models.ForeignKey(Kunde, db_column='kunde') tarif = models.ForeignKey(Tarif, db_column='tarif') tarifname = models.ForeignKey(Tarifname, db_column='tarifname') dienst = models.IntegerField() anzahl = models.IntegerField() beginn = models.IntegerField() ende = models.IntegerField() ablauf = models.IntegerField() notiz = models.IntegerField() info = models.ForeignKey(String, db_column='info') infotext = models.CharField(maxlength=255) rechnung = models.TextField() nextrech = models.IntegerField() timestamp = models.DateTimeField() class Meta: db_table = 'tarifkunde'
cc to mtredinnick since he closed this ticket.
comment:3 by , 18 years ago
This is a bit subtle. It's triggered by the Tarifkunde.nextrech field -- which is why a related_name is required on Nextrech.tarifkunde. Without that (and after fixing the other fields so that this imports), no error. It's a bug, but triggered by strange circumstances. Fixing it now.
comment:4 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:5 by , 18 years ago
Component: | django-admin.py → Template system |
---|---|
milestone: | → Version 1.1 |
priority: | high → low |
Severity: | normal → major |
Type: | defect → enhancement |
Version: | magic-removal |
get_validation_errors must check edit_inline attribute