Opened 7 years ago
Closed 7 years ago
#29567 closed Bug (duplicate)
It raise FieldError when the F() function uses a forign key field.
| 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
Change History (2)
comment:1 by , 7 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 7 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Duplicate of (wontfix) #14104, see also https://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once