Overview
Django REST Framework 3.14, released on September 27, 2022, supports Django 4.1 and improves OpenAPI schema generation.
Main Features
Django 4.1 support
DRF 3.14 is fully compatible with Django 4.1 and its new features like improved database constraints.
python
from rest_framework import serializers, viewsets
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
class ArticleSerializer(serializers.ModelSerializer):
class Meta:
model = Article
fields = '__all__'
class ArticleViewSet(viewsets.ModelViewSet):
queryset = Article.objects.all()
serializer_class = ArticleSerializer
Improved OpenAPI schemas
OpenAPI schema generation is improved with better type support and tighter integration with documentation tools.
python
from rest_framework.schemas import get_schema_view
from django.urls import path
schema_view = get_schema_view(
title='My API',
description='DRF 3.14 demo API',
version='1.0.0',
)
urlpatterns = [
path('schema/', schema_view, name='openapi-schema'),
]
