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 Initial Version

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

`
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('bname'))

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 (0)

Note: See TracTickets for help on using tickets.
Back to Top