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

@ -71,9 +71,11 @@ Suppose you have this pair of models, representing a small blog system::
import datetime
from django.db import models
class Blog(models.Model):
...
class Entry(models.Model):
blog = models.ForeignKey(Blog, on_delete=models.CASCADE)
published = models.DateTimeField(default=datetime.datetime.now)
@ -92,6 +94,7 @@ for your front page view::
from django.views.decorators.http import condition
@condition(last_modified_func=latest_entry)
def front_page(request, blog_id):
...
@ -135,6 +138,8 @@ using one of these decorators::
def front_page(request, blog_id):
...
front_page = last_modified(latest_entry)(front_page)
Use ``condition`` when testing both conditions
@ -152,6 +157,7 @@ this would lead to incorrect behavior.
def my_view(request):
...
# End of bad code.
The first decorator doesn't know anything about the second and might