How Django Evolved from A Backend to A Full Stack Framework?

Django, a Python web framework, has remarkably transformed from a robust backend framework to a versatile full-stack solution. Django was designed to emphasize the “don’t repeat yourself” (DRY) principle and reusability for streamlined web development, but it has expanded its capabilities impressively throughout the years.

This article will take you on Django’s transformation journey. We will highlight the notable version release, its features, and how these new capabilities have helped this framework evolve into a full-stack powerhouse.

Page Contents

 1. Version 0.96

Source: crowdbotics.com

The 0.96 release added the following new features that expanded Django’s capabilities beyond traditional backend development:

  • Admin interface improvements: In the 0.96 version, Django added dedicated views to add and update users in the admin interface. This feature simplified the user management process and enhanced the security of web applications.
  • New forms library (django.newforms): Django replaced the old django.forms framework with the new django.newforms library in this release. The new library allows dedicated Django developers to create and manage new forms in a web application easily and flexibly.
  • Test framework: Django added a new testing framework in this release. This testing framework enables programmers to use doctest or unittest and test views with a simple test client for writing tests. Furthermore, the testing framework ensures reliable and stable frontend interaction and backend logic during web app development. Additionally, the new support for “fixtures” allows a Django developer to load real data on the database easily at the beginning of the tests.
  • URLconf improvements: Initially, Django only allowed strings that referred to callables in URLconfs. In the 0.96 release, any callable can be used as the callback in URLconfs. This new feature made URL configurations more flexible and intuitive. Furthermore, it enabled the usage of decorators in URLconfs, allowing dedicated Django developers to apply login requirements to view and other functionalities quite easily. Hence, this new feature enhanced Django’s route and view handling capabilities.

2. Version 1.0

Source: creativeitinstitute.com

The 1.0 version released several new features and functionalities that extended Django’s capabilities beyond backend development:

  • Automatic escaping of template variables: In the 1.0 version, Django’s template system automatically escapes the output of variables to safeguard web applications against cross-site scripting (XSS) vulnerabilities. Furthermore, the behavior is configurable, which allows larger template constructs and variables to be marked as safe (when it does not require escaping) and unsafe (when it requires escaping).
  • django.contrib.gis (GeoDjango): django.contrib.gis is a newly added Geographic Information Systems (GIS) support. This new support expands Django web applications’ capabilities to handle geospatial data efficiently.
  • Generic relations in forms and admin: Django included classes in django.contrib.contenttypes. These classes support generic relations between the admin interface and end-user forms for flexible content types and relations in web applications.
  • Improved Object-Relational Mapper (ORM): Django’s object-relational mapper underwent a major refactoring that improved mapping between Django model classes and the database. This refactoring resulted in robust database interactions and enhanced full-stack development.
  • Improved Unicode handling: In the 1.0 release, Django integrated Unicode throughout its internals. This integration simplifies dealing with non-Western-European data and content. Hence, with this new feature, Django can efficiently manage diverse data types for improved web applications.
  • INSERT/UPDATE Distinction: Previously, Django automatically determined to perform an INSERT or an UPDATE when having a model’s save() method. In the 1.0 release, Django supports an additional parameter that forces specific SQL operations (an INSERT or an UPDATE). This support has proved useful in occasional situations and enables finer management of database interactions. Hence, these results prove beneficial for web applications with complex architecture.
  • Pluggable file storage: The 1.0 release enables the use of pluggable file-storage backends in its FileField and ImageField. This usage provides Django experts greater customization to handle how Django stores uploaded files. Furthermore, this customization helps web applications handle heavy media content efficiently.
  • Refactored admin application: In this release, django.contrib.admin (the Django administrative interface) underwent a complete refactoring. In this refactoring process, Django decoupled admin definitions from model definitions, eliminating the declaration of class Admin in models. Furthermore, the interface was redesigned to let Django developers handle the django.newforms (released in version 0.96 and now available ad django.forms) extensively and flexibly.
  • Refactored django.contrib.comments: Django rewrote and refactored its bundled comment system (django.contrib.comments) to increase its customizability and flexibility. Therefore, Django developers can flexibly integrate interaction features in full-stack applications.
  • Split CacheMiddleware: In the 1.0 release, Django divided CacheMiddleware into three classes. Despite existing and retaining its previous functionalities, CacheMiddleware is now built of two separate middleware classes that handle inserting into and reading from the cache processes separately. This division provides more flexibility in caching operations, ensuring optimized performance in full-stack development.

3. Version 1.3

Django Version 1.3

Source: udacity.com

Version 1.3 added the following features and functionalities that enhanced Django’s frontend development capabilities:

  • Extended static file handling: Django introduced the django.contrib.staticfiles contrib app that streamlined static media file management. This feature allows Django developers to handle CSS, images, JavaScript, and other static media files separately from user-uploaded files, ensuring efficient web page rendering. Hence, this feature optimizes frontend development.
  • Caching changes: The Django 1.3 release introduced three changes to its caching infrastructure. Django now supports multiple named caches, allowing developers to define multiple named cached connections using the new CACHES setting. Furthermore, Django added site-wide prefixing, transformation, and versioning to the cache API. Django also updated cache key creation to take request query strings on GET requests. Moreover, Django added support for pylibmc to its memcached cache backend. All these changes help in developing performance-optimized full-stack applications.
  • Class-based views: In its 1.3 version, Django has added a framework that enables the use of a class as a view. This enables dedicated Django developers to compose a view from a collection of methods, which can be subclassed and overridden. This approach enables developers to manage views in an organized and reusable manner for efficient frontend development.
  • Contextual markers and comments for translatable strings: Django added the pgettext function and special translator comments in its 1.3 version. The pgettext function helps developers to handle translation strings with ambiguous meanings. When added to the source, the special translator comments add information for translators. These additions enhance internationalization support for user-facing applications.
  • TemplateResponse: Django introduced the TemplateResponse class, enabling decorators or middleware to modify a response after the view constructs it. This feature allows developers to dynamically add data to the context or change templates for enhanced frontend flexibility.
  • Transaction context managers and configurable delete-cascade: In its 1.3 version, Django enabled developers with Python 2.5 and above versions to use transaction management functions as context managers. Furthermore, Django’s ForeignKey and OneToOneField accept the on_delete argument to customize behavior (like do nothing, protect, set default, set null, or set to any value) when reference objects are deleted. Both these features provide greater database control for efficient backend and frontend development.

4. Version 1.4

Source: forum.djangoproject.com

Version 1.4 is also a notable milestone in Django’s transformational journey from a backend to a frontend. Some of the notable features and functionality that were added in this version include:

  • Contextual translation support: Django extended the contextual translation support (added in version 1.3) to the trans and blocktrans template tags using the keyword context. This extension improved Django’s ability to manage translations in templates.
  • Cryptographic signing tools: Django 1.4 added a low-level API and a high-level API. The low-level API allows developers to sign values, while the high-level API allows setting and reading signed cookies. Both these tools enhance security while signing in to web applications.
  • Enhanced WSGI support: The startproject management command added a wsgi.py module containing a simple WSGI application to the initial project layout. This streamlines deploying Django applications using WSGI.
  • HTML5 doctype: Django 1.4 now ensures that the admin and other bundled templates utilize the HTML5 doctype. This feature allows developers to implement any HTML5 feature in the admin interface without losing HTML validity or overriding provided templates.
  • Integration with in-browser testing frameworks: Django 1.4 allows the integration of in-browser testing frameworks like Selenium. Furthermore, the django.test.LiveServerTestCase base class allows you to test your application’s front and backend interactions.
  • Internationalization enhancements: Django’s newly introduced i18n_patterns() helper function allows developers to search language prefixes in the URLpattern and use django.utils.translation.ugettext_lazy() to define translatable URL patterns. These enhance Django’s internalization capabilities.
  • List filters and multiple sort in the admin interface: Django 1.4 enables web developers to change list filters by specifying a field lookup using a simple API. Furthermore, it also allowed the sorting on multiple columns. Hence, Django now offers a dynamic and user-friendly admin interface.
  • New form wizard: Django 1.4 replaced its previous FormWizard with a new implementation based on class-based views. This new form wizard features a pluggable storage API. Furthermore, it does not require passing around hidden fields for its previous steps. Hence, it ensures efficient form-handling processes.
  • reverse_lazy function: Django added a lazily evaluated version of the reverse() to use URL reversals before loading the project’s URLconf​.
  • Support for time zones: Django 1.4 allows developers to switch to a timezone aware mode. This mode enables Django to store date/time information in UTC, internally use datetime objects, and translate them into users’ local timezones in forms and displays. The feature ensured customized date/time for global users, database portability and interoperability, and DST transition-based data corruption prevention. Therefore, applications serving a global audience can now accurately represent local time zones.

5. Version 1.6

Source: pcmag.com

Django 1.6 introduced the following features that enhanced its capabilities as a full-stack framework:

  • BinaryField model field: In the 1.6 version, Django added the django.db.models.BinaryField model. This model stores binary raw data in the database, ensuring efficient binary data handling in applications.
  • Locating tests in any test module: Django 1.6 introduced a new test runner for flexible test locations. This feature allows developers to locate tests in any module with a name similar to the pattern test*.py. This ensures efficient organization of tests.
  • GeoDjango form widgets: GeoDjango offers form fields and widgets. Despite being OpenLayers-based by default, developers can customize them using any JavaScript framework. This significantly benefited web applications dealing with geographical data.
  • Improved transaction management: Django overhauled transaction management to turn on database-level autocommit by default in this version. This resulted in explicit and performance-optimized transaction management.
  • Persistent database connections: Django 1.6 allows developers to use the same database connections across several requests. This decreases the overhead of re-establishing new connections at the beginning of requests. Hence, it optimizes the performance of applications managing high database traffic.
  • Python compatibility: Apart from continuing to support Python 2.6.5, Django 1.6 officially started supporting Python 3. This compatibility enabled dedicated Django developers to use modern Python features and libraries in Django projects.
  • Simplified default project and app templates: Django 1.6 modernized and simplified the default templates for startproject and startapp. Now, the admin is enabled rather than the sites framework by default in new projects. Furthermore, Django 1.6 turns clickjacking prevention on, and the database defaults to SQLite. Hence, this update allows developers to start a new project with a clean, contemporary structure.
  • Time zone aware aggregation: In Django 1.6, developers can use QuerySet.dates() for time zone aware aggregation on a DateTimeField.

6. Version 1.8

django Version 1.8

Source: betterprogramming.pub

Django 1.8 added more features and functionalities, enhancing the framework’s full-stack development capabilities.

  • django.contrib.admindocs improvements: Django 1.8 parsed reStructuredText in model docstrings. This integration improved documentation capabilities.
  • django.contrib.auth enhancements: Django 1.8 improved django.contrib.auth in several ways. It allowed authorization backends to raise PermissionDenied has_module_perms() and has_perm() for short-circuit permission checking. Furthermore, it has added a send_mail() method in PasswordResetForm that can be overridden to customize emails. It also increased the max_length of Permission.name from 50 to 255 characters. Moreover, it enabled REQUIRED_FIELDS and USERNAME_FIELD to support ForeignKeys. It also increased the PBKDF2 password hasher’s default iteration count by 33%. All these enhancements improved authorization management and user authentication.
  • Formalized API for Model._meta: Django now has an officially supported formalized API to filter and retrieve fields based on their attributes. This API improves Django’s data manipulation and modeling capabilities.
  • Minor Features in django.contrib.admin: Django 1.8 has introduced minor features in the django.contrib.admin.

The has_module_permission() method in ModelAdmin limits module access on the admin index page. Furthermore, the show_change_link attribute in InlineModelAdmin shows a link to an inline object’s change form. The django.contrib.admin.RelatedOnlyFieldListFilter in ModelAdmin.list_filter limits list_filter choices to ModelAdmin-attached foreign objects.

The ModelAdmin.delete_view() shows a gist of the removable objects on the deletion confirmation page. Moreover, the admin-embedded jQuery library was upgraded to the 1.11.2 version. Developers can specify AdminSite.site_url to display a link on the application’s frontend. Developers can also establish ModelAdmin.show_full_result_count to control the decision of displaying the full count of objects on a filtered admin page.

An extra_context parameter was added to the AdminSite.password_change() method. Furthermore, developers can control who can override AdminSite.has_permission() and AdminSite.login_form and login to the admin site. A new block usertools, comprising user-specific headers, was added to the base.html template. A new context variable has_permission receives its value from has_permission() to ensure authorized access to the site. Furthermore, dropdowns in foreign keys enable developers to change/delete related objects using popups.

  • Multiple template engines: Django 1.8 introduced a stable API for integrating stable backends. This API includes built-in Django template language and Jinja2. Furthermore, it renders templates in multiple engines in the same project. Hence, this API ensures faster, flexible, and varied frontend development.
  • New data types: The 1.8 version introduced two new data types – UUIDField for universally unique identifier storage and DurationField for storing timedelta-modeled time periods. These new additions expanded Django’s capabilities of handling diverse data types.
  • PostgreSQL-specific functionality: Several PostgreSQL-specific features like ArrayField, HStoreField, Range Fields, and unaccent lookup were added to Django. These features expanded its database functionality.
  • Security enhancements: Django was integrated with features like django.middleware.security.SecurityMiddleware and check –deploy from the django-secure library. The former enhances request/response cycle security, and the latter enables checking production settings files.
  • Query expressions, conditional expressions, and database functions: In Django 1.8, developers can use query expressions to customize and create complex SQL expressions. It also allows developers to use conditional expressions to implement if, elif, and else logic in queries. Furthermore, it included a collection of database functions with functionality such as Coalesce, Concat, and Substr.
  • TestCase data setup: Django 1.8 refactored TestCase for data initialization, using transactions and savepoints, at the class level. Further, tests run within two nested atomic() blocks (one for the whole class and the other for each test). This speeds up tests and requires a single fixture loading for the entire TestCase.

7. Version 2.0

Source: danielhonrade.com

The following 2.0 updates reflect Django’s transformation into a more full-stack-oriented framework:

  • Mobile-Friendly admin interface: Django 2.0 updated contrib.admin into a mobile-friendly and responsive one. Therefore, the framework’s admin interface can adapt to various screen sizes for a better user experience.
  • Simplified URL routing syntax: The new django.urls.path() function delivers a more readable and simpler way to define URL patterns. Furthermore, this URL supports type coercion of URL parameters. Hence, this offers a flexible and intuitive URL routing compared to the early regular expression-based approach.
  • Window expressions: The new Window expression enables the use of database window functions in querysets. Furthermore, it eliminates the requirement of raw SQL queries for performing aggregation, ranking, partitioning, and other complex database queries.

8. Version 3.0

Source: coursera.org

Django 3.0 added several new features that have started turning Django into an advanced full-stack framework:

  • ASGI support: Django 3.0 introduced Asynchronous Server Gateway Interface (ASGI) for asynchronous web app development operations. Furthermore, it complements the existing WSGI support. Hence, this feature can help manage long-running connections and integrate real-time web features.
  • Enumeration for model field choices: Django 3.0 introduced the following custom enumeration types – Choices, IntegerChoices, and TextChoices. These types structurally define field choices and support human-readable labels and translations. Henceforth, it offers expressive and user-friendly data modeling.
  • Exclusion constraints on PostgreSQL: The ExclusionConstraint class was introduced in the 3.0 version. This class enables exclusion constraint implementation in PostgreSQL. Hence, it assists in advanced database modeling and integrity.
  • Filter expressions: Django 3.0 enabled developers to use expressions that deliver BooleanField directly in QuerySet filters. Hence, it streamlined the querysets filtering process, making it concise and efficient.
  • MariaDB support: In the 3.0 version, Django officially started supporting MariaDB 10.1 and its higher versions. Therefore, with extended database support. Django can cater to a wider range of backend database options for web applications.

Conclusion

Since 2003, Django has continued delivering extensive libraries and packages, enriched features, an active community of Django developers, and much more. Its journey from a backend development framework to an adaptable full-stack framework is truly impressive. Django is still expanding, and in the near future, it will fully transform into a full-stack development framework. We provide the latest news about Django, so keep an eye on us to learn more about its growth and offerings to the development community.