Django 3.0 is going to be released in early December with lots of new features. I am going to highlight some of my most favorite features of Django 3.0 in this post. For detailed release notes, you can visit the official site of Django.
I use the Django ORM, Schema migrations framework, content-types etc most with Django-rest-framework & PostgreSQL, so I am going to start with the ORM and database changes first.
ORM
I use the Django ORM, Schema migrations framework, content-types etc most with Django-rest-framework & PostgreSQL, so I am going to start with the ORM and database changes first.
ORM
- It is now possible to use Expressions direct into filter QuerySet instead of annotating them first. This means using expressions that have a BoleanField as output_field, can be used directly in Queryset filters, or in the When() clause of a Case() expression. For example:
inner = Company.objects.filter(ceo=OuterRef('pk')).values('pk') qs1 = Employee.objects.filter(Exists(inner)) instead of
Employee.objects.annotate(found=Exists(inner)).filter(found=True)
Comments
Post a Comment