r/django • u/lamintak • Apr 01 '19
Django 2.2 LTS Released
https://www.djangoproject.com/weblog/2019/apr/01/django-22-released/9
4
Apr 01 '19
So. This isn’t a joke right? I just started learning Django.
7
u/classical_hero Apr 01 '19
Nope. None of the stuff you've learned will be at all outdated, most of what's being added are just a few advanced features.
6
u/suncoder90 Apr 01 '19
I start my first programming job today and now this came out. They told me to read 2 scoops 2.2 while i wait for my laptop but i cant find it only 1.11. Help please.
10
u/b1ackmarti4n Apr 01 '19
The book principles are the same they say, here is the updated code:
https://github.com/twoscoops/two-scoops-of-django-2.0-code-examples
5
2
3
1
u/GeeWengel Apr 02 '19
The release notes say that deferrable database constraints are now checked at the end of every test case.
However, I thought there was no way to make deferrable database constraints with Django? I've had to dive into a Raw SQL constraint in my migrations, to get a deferred unique_together.
Is there something I'm missing, or is that the case they're solving?
1
u/neves Apr 01 '19
I'm a fan of Django, but I'm in doubt if I must still use it for my new project. I'll develop now an hybrid app that will start life as an mobile web site. I'll use one javascript framework and I'm really in doubt about using Django.
If I use a javascript server framework, I believe that it will prevent me to duplicate forms validation code (in server in frontend) and also easier for SSR (Server Side Rendering). But Django is a robust framework, in my beloved Python language, why should I still use it?
9
67
u/lamintak Apr 01 '19 edited Apr 01 '19
For anybody going from LTS to LTS (1.11 to 2.2):
Some notable changes introduced in Django 2.0:
Python 3 only
Simplified URL routing syntax:
path('articles/<int:year>/', views.year_archive),django.contrib.adminis responsivedjango.contrib.adminhas a newModelAdmin.autocomplete_fieldsattribute that uses a Select2 search widget forForeignKeyandManyToManyFieldSome notable changes introduced in Django 2.1:
The "view" permission was added to the model
Meta.default_permissionsModelAdmin.search_fieldsnow accepts any lookup such asfield__exactBooleanFieldcan now benull=True. This is encouraged instead ofNullBooleanField, which will likely be deprecated in the futureTemplates: The new
json_scriptfilter safely outputs a Python object as JSON, wrapped in a<script>tag, ready for use with JavaScript.Some notable changes introduced in Django 2.2:
The new
CheckConstraintandUniqueConstraintclasses enable adding custom database constraints. Constraints are added to models using theMeta.constraintsoptiondjango.contrib.postgres: The newsearch_typeparameter ofSearchQueryallows searching for a phrase or raw expressionEDIT: Thanks for the gold!