1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #34140 -- Reformatted code blocks in docs with blacken-docs.

This commit is contained in:
django-bot
2023-02-28 20:53:28 +01:00
committed by Mariusz Felisiak
parent 6015bab80e
commit 14459f80ee
193 changed files with 5797 additions and 4481 deletions

View File

@@ -178,16 +178,18 @@ class method can now directly :ref:`create Manager with QuerySet methods
class FoodQuerySet(models.QuerySet):
def pizzas(self):
return self.filter(kind='pizza')
return self.filter(kind="pizza")
def vegetarian(self):
return self.filter(vegetarian=True)
class Food(models.Model):
kind = models.CharField(max_length=50)
vegetarian = models.BooleanField(default=False)
objects = FoodQuerySet.as_manager()
Food.objects.pizzas().vegetarian()
Using a custom manager when traversing reverse relations
@@ -199,14 +201,16 @@ It is now possible to :ref:`specify a custom manager
class Blog(models.Model):
pass
class Entry(models.Model):
blog = models.ForeignKey(Blog)
objects = models.Manager() # Default Manager
entries = EntryManager() # Custom Manager
entries = EntryManager() # Custom Manager
b = Blog.objects.get(id=1)
b.entry_set(manager='entries').all()
b.entry_set(manager="entries").all()
New system check framework
--------------------------
@@ -1024,11 +1028,13 @@ WSGI scripts
Until Django 1.3, the recommended way to create a WSGI application was::
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
In Django 1.4, support for WSGI was improved and the API changed to::
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
If you're still using the former style in your WSGI script, you need to
@@ -1528,7 +1534,7 @@ for a particular form instance. For example (from Django itself)::
PasswordChangeForm.base_fields = OrderedDict(
(k, PasswordChangeForm.base_fields[k])
for k in ['old_password', 'new_password1', 'new_password2']
for k in ["old_password", "new_password1", "new_password2"]
)
Custom SQL location for models package