Opened 6 years ago
Last modified 6 years ago
#29567 closed Bug
It raise FieldError when the F() function uses a forign key field. — at Version 1
Reported by: | HongWeipeng | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
class B(models.Model): name = models.CharField(max_length=10) class A(models.Model): name = models.CharField(max_length=10) b = models.ForeignKey('B', on_delete=models.CASCADE)
And then:
A.objects.all().update(name=F('b__name')) raise FieldError("Joined field references are not permitted in this query") django.core.exceptions.FieldError: Joined field references are not permitted in this query
Note:
See TracTickets
for help on using tickets.