#33127: "&" and "|" operators are silently ignored after QuerySet.union(), intersection(), and difference(). -------------------------------------+------------------------------------- Reporter: Maxwell | Owner: nobody Tietze | Type: | Status: new Cleanup/optimization | Component: Database | Version: 3.1 layer (models, ORM) | Severity: Normal | Keywords: Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- This looks like a similar issue to the one fixed in [https://code.djangoproject.com/ticket/27995 #27995]
Example: {{{ class MyModel(models.Model): name = models.CharField() for name in ['a', 'b', 'c']: MyModel.objects.create(name=name) group1 = MyModel.objects.filter(name='a') group2 = MyModel.objects.filter(name='b') group3 = MyModel.objects.filter(name='c') combined_group = group1.union(group2) group_and = combined_group & group1 group_or = combined_group | group 3 }}} In this example, combined_group, group_and and group_or all have the same SQL. These operators should raise an exception if they can not be applied after combinator functions. -- Ticket URL: <https://code.djangoproject.com/ticket/33127> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/050.53b2f430b18091e9f5983cb60932de79%40djangoproject.com.