#13228 closed (duplicate)
queryset.update() on custom manager ignores all filter
| Reported by: | flytwokites | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Keywords: | update | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
model:
class Party(models.Model):
name = models.CharField(max_length=50)
is_company = models.BooleanField()
class CompanyManager(models.Manager):
def get_query_set(self):
return super(CompanyManager, self).get_query_set().filter(is_company=True)
class Company(Party):
objects = CompanyManager()
class Meta:
proxy = True
show bug:
>>> Company.objects.create(name='GlideTools') >>> Company.objects.filter(name='M$') [] >>> Company.objects.filter(name='M$').update(name='What?!') 1 >>> [p.name for p in Party.objects.all()] [u'What?!']
The update() updates all objects, All filters on it is ignored!
Note:
See TracTickets
for help on using tickets.
This is a dupe of #12247.