- A GET request with side-effects
- A model with a
…Model
suffix - calling
all()
beforecount()
orfilter()
etc. Chain
ing querysets together- Checking ownership through the
UserPassesTestMixin
- Checking request method with
if request.POST
- Constructing a new form when validation fails
- Fetching the logged in user with a query
- Fill the primary key gaps
- Filter on arbitrary input like request.GET
- Filtering in the template
- Foreign key with
_id
suffix - Giving
related_name=…
the same name as the relation - Imports
- Manually constructing a slug
- Modifying slugs and primary keys of model objects
- non-atomic
JSONField
s - (Over)use of
.values()
- passing function references to reverse
- Passing parameters directly in the query string of a URL
- Plural model class names
- Refer to the
User
model directly - Rendering content after a successful POST request
- Rendering into JavaScript
- Return a
JsonResponse
withsafe=False
- Run
makemigrations
in production - Signals
- Use
datetime.now
asdefault=…
for acreated_on
field - Use
.get(…)
to retrieve the object in a view - Using a
FloatField
for currencies - Using
commit=False
when altering the instance in aModelForm
- Using
len(…)
on aQuerySet
with no further use - Using multiple forms on the same page without prefixing
- Using regular HTML comments instead of Django template comments
- Using
request.POST or None