Opened 11 years ago
Closed 11 years ago
#22935 closed Bug (fixed)
Error message in ForeignKey.default_error_messages does not reflect the correct field when 'to_field' is used.
| Reported by: | ANUBHAV JOSHI | Owned by: | ANUBHAV JOSHI |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | anubhav9042@… | Triage Stage: | Accepted |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If model be like
class Person(models.Model):
name = models.CharField(max_length=30)
class Student(models.Model):
per = models.ForeignKey(Person, to_field='name')
Now if invalid error comes up from validate(), it will be like
'person instance with pk 'somename' does not exist.'
It should be:
'person instance with name 'somename' does not exist.'
Change History (3)
comment:1 by , 11 years ago
| Cc: | added |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 11 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
I am marking this accepted as Tim and I found this out while working on some other ticket and he told me open a ticket for this and work on it.