summaryrefslogtreecommitdiff
path: root/docs/releases/3.1.txt
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2023-02-28 20:53:28 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-03-01 13:03:56 +0100
commit14459f80ee3a9e005989db37c26fd13bb6d2fab2 (patch)
treeeb62429ed696ed3a5389f3a676aecfc6d15a99cc /docs/releases/3.1.txt
parent6015bab80e28aef2669f6fac53423aa65f70cb08 (diff)
Fixed #34140 -- Reformatted code blocks in docs with blacken-docs.
Diffstat (limited to 'docs/releases/3.1.txt')
-rw-r--r--docs/releases/3.1.txt25
1 files changed, 16 insertions, 9 deletions
diff --git a/docs/releases/3.1.txt b/docs/releases/3.1.txt
index d1b75c8760..50430ec1be 100644
--- a/docs/releases/3.1.txt
+++ b/docs/releases/3.1.txt
@@ -41,7 +41,7 @@ To get started with async views, you need to declare a view using
async def my_view(request):
await asyncio.sleep(0.5)
- return HttpResponse('Hello, async world!')
+ return HttpResponse("Hello, async world!")
All asynchronous features are supported whether you are running under WSGI or
ASGI mode. However, there will be performance penalties using async code in
@@ -76,18 +76,22 @@ PostgreSQL-only::
from django.db import models
+
class ContactInfo(models.Model):
data = models.JSONField()
- ContactInfo.objects.create(data={
- 'name': 'John',
- 'cities': ['London', 'Cambridge'],
- 'pets': {'dogs': ['Rufus', 'Meg']},
- })
+
+ ContactInfo.objects.create(
+ data={
+ "name": "John",
+ "cities": ["London", "Cambridge"],
+ "pets": {"dogs": ["Rufus", "Meg"]},
+ }
+ )
ContactInfo.objects.filter(
- data__name='John',
- data__pets__has_key='dogs',
- data__cities__contains='London',
+ data__name="John",
+ data__pets__has_key="dogs",
+ data__cities__contains="London",
).delete()
If your project uses ``django.contrib.postgres.fields.JSONField``, plus the
@@ -591,6 +595,7 @@ form::
from django import forms
from django.contrib.auth.forms import UserChangeForm
+
class MyUserChangeForm(UserChangeForm):
first_name = forms.CharField(max_length=30, required=False)
@@ -600,9 +605,11 @@ If you wish to keep this restriction in the admin when editing users, set
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
+
class MyUserAdmin(UserAdmin):
form = MyUserChangeForm
+
admin.site.unregister(User)
admin.site.register(User, MyUserAdmin)