mirror of
https://github.com/django/django.git
synced 2025-10-24 22:26:08 +00:00
[5.0.x] Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Backport of 305757aec1 from main
This commit is contained in:
@@ -72,8 +72,7 @@ Suppose you have this pair of models, representing a small blog system::
|
||||
from django.db import models
|
||||
|
||||
|
||||
class Blog(models.Model):
|
||||
...
|
||||
class Blog(models.Model): ...
|
||||
|
||||
|
||||
class Entry(models.Model):
|
||||
@@ -96,8 +95,7 @@ for your front page view::
|
||||
|
||||
|
||||
@condition(last_modified_func=latest_entry)
|
||||
def front_page(request, blog_id):
|
||||
...
|
||||
def front_page(request, blog_id): ...
|
||||
|
||||
.. admonition:: Be careful with the order of decorators
|
||||
|
||||
@@ -131,13 +129,11 @@ We could write the earlier example, which only uses a last-modified function,
|
||||
using one of these decorators::
|
||||
|
||||
@last_modified(latest_entry)
|
||||
def front_page(request, blog_id):
|
||||
...
|
||||
def front_page(request, blog_id): ...
|
||||
|
||||
...or::
|
||||
|
||||
def front_page(request, blog_id):
|
||||
...
|
||||
def front_page(request, blog_id): ...
|
||||
|
||||
|
||||
front_page = last_modified(latest_entry)(front_page)
|
||||
@@ -154,8 +150,7 @@ this would lead to incorrect behavior.
|
||||
# Bad code. Don't do this!
|
||||
@etag(etag_func)
|
||||
@last_modified(last_modified_func)
|
||||
def my_view(request):
|
||||
...
|
||||
def my_view(request): ...
|
||||
|
||||
|
||||
# End of bad code.
|
||||
|
||||
Reference in New Issue
Block a user