Prior to this, I enjoyed using django version 3.2 for some reasons. Although once, I tried upgrading to version 4.0 but my admin site refused to work because of some issues so I just left it without rectifying the issue. Recently, I decided to upgrade my django projects to a higher version at all cost which I did even after facing the same issue I faced before. I'll look into rectifying the issue just in case someone faces that problem while upgrading to a new version.
Like I said earlier on, I loved working with v3.2 but django support for v3.2, ends this month. That wouldn't be a big problem though but looking at the release notes for v4.2, I'm really impressed.
Here are a few updates that impressed me and why I think you should consider upgrading your django version.
Psycopg 3 support:
Django now supports psycopg version 3.1.8 or higher. Support for psycopg2 is likely to be deprecated and removed at some point in the future.Comments on columns and tables:
The new Field.db_comment and Meta.db_table_comment options allow creating comments on columns and tables, respectively. For example:
from django.db import models
class Question(models.Model):
text = models.TextField(db_comment="Poll question")
pub_date = models.DateTimeField(
db_comment="Date and time when the question was published",
)
class Meta:
db_table_comment = "Poll questions"
Mitigation for the BREACH attack:
If there is any reason why django is the best framework out there, it's its concern for web security.
GZipMiddleware now includes a mitigation for the BREACH attack. It will add up to 100 random bytes to gzip responses to make BREACH attacks harder. Also, for user authentication, the default iteration count for the PBKDF2 password hasher is increased from 390,000 to 600,000. Such an amazing feature.Error Reporting:
If you have used python3.11 you might have noticed how errors are displayed; showing exactly where the errors are and possible fixes. Well, if you use djangov4.2 and python3.11+, Error reporting just got better.
The debug page now shows exception notes and fine-grained error locations, Session cookies are now treated as credentials and therefore hidden and replaced with stars (**********) in error reports.
Fixing Admin site issue
The issue I faced when upgrading to v4 was a timezone
error so to fix that, quickly install tzdata
on the command line.
$ pip install tzdata
That will be all for now guys, don't forget to leave a comment. See you on the next one!
Top comments (0)