Opened 15 years ago
Closed 15 years ago
#11938 closed (duplicate)
`to_field` does not function as expected.
Description ¶
In lookups involving a ForeignKey
, or a ManyToMany
intermediary table using a to_field
they fail due to looking for the primary key, rather than the field specified by to_field
.
For example:
user = models.ForeignKey(User, to_field="username") # Fails SimpleModel.objects.get(user=self.user)
Change History (3)
by , 15 years ago
Attachment: | to_field_tests.py added |
---|
by , 15 years ago
Attachment: | to_field_tests.2.py added |
---|
comment:1 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Additional test case on deletion.