Merge branch 'master' into resolve-local-https

This commit is contained in:
Bruno Alla 2024-08-05 20:13:48 +01:00 committed by GitHub
commit ab77ffb2b8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 189 additions and 51 deletions

View File

@ -1603,5 +1603,10 @@
"name": "Ali Shamakhi",
"github_login": "ali-shamakhi",
"twitter_username": ""
},
{
"name": "Filipe Nascimento",
"github_login": "FilipeNas",
"twitter_username": ""
}
]

View File

@ -26,14 +26,14 @@ repos:
args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade
rev: v3.16.0
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py312-plus]
exclude: hooks/
- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.8.0
hooks:
- id: black
@ -43,7 +43,7 @@ repos:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.1.1
hooks:
- id: flake8

View File

@ -3,6 +3,129 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER -->
## 2024.08.04
### Updated
- Update uvicorn to 0.30.5 ([#5272](https://github.com/cookiecutter/cookiecutter-django/pull/5272))
- Update ruff to 0.5.6 ([#5273](https://github.com/cookiecutter/cookiecutter-django/pull/5273))
- Auto-update pre-commit hooks ([#5274](https://github.com/cookiecutter/cookiecutter-django/pull/5274))
## 2024.07.31
### Updated
- Update uvicorn to 0.30.4 ([#5271](https://github.com/cookiecutter/cookiecutter-django/pull/5271))
- Update mypy to 1.11.1 ([#5270](https://github.com/cookiecutter/cookiecutter-django/pull/5270))
- Update pre-commit to 3.8.0 ([#5257](https://github.com/cookiecutter/cookiecutter-django/pull/5257))
- Update pyupgrade pre-commit hook to v3.17.0 ([#5258](https://github.com/cookiecutter/cookiecutter-django/pull/5258))
- Update redis to 5.0.8 ([#5265](https://github.com/cookiecutter/cookiecutter-django/pull/5265))
- Update django-stubs to 5.0.4 ([#5256](https://github.com/cookiecutter/cookiecutter-django/pull/5256))
- Update mypy to 1.11.0 ([#5231](https://github.com/cookiecutter/cookiecutter-django/pull/5231))
- Update django-allauth to 64.0.0 ([#5269](https://github.com/cookiecutter/cookiecutter-django/pull/5269))
- Update sentry-sdk to 2.12.0 ([#5268](https://github.com/cookiecutter/cookiecutter-django/pull/5268))
## 2024.07.26
### Updated
- Update ruff to 0.5.5 ([#5250](https://github.com/cookiecutter/cookiecutter-django/pull/5250))
## 2024.07.25
### Changed
- Upgrade to Django 5.0 ([#5199](https://github.com/cookiecutter/cookiecutter-django/pull/5199))
### Updated
- Update pytest to 8.3.2 ([#5249](https://github.com/cookiecutter/cookiecutter-django/pull/5249))
- Update sentry-sdk to 2.11.0 ([#5247](https://github.com/cookiecutter/cookiecutter-django/pull/5247))
## 2024.07.24
### Changed
- fix non existent of two scoops of django image ([#5248](https://github.com/cookiecutter/cookiecutter-django/pull/5248))
## 2024.07.23
### Changed
- Ensure that awscli service has a CMD to fix #5241 ([#5245](https://github.com/cookiecutter/cookiecutter-django/pull/5245))
### Fixed
- Downgrade watchfiles ([#5243](https://github.com/cookiecutter/cookiecutter-django/pull/5243))
## 2024.07.22
### Updated
- Update django-compressor to 4.5.1 ([#5240](https://github.com/cookiecutter/cookiecutter-django/pull/5240))
## 2024.07.21
### Updated
- Update ruff to 0.5.4 ([#5237](https://github.com/cookiecutter/cookiecutter-django/pull/5237))
- Update pytest to 8.3.1 ([#5236](https://github.com/cookiecutter/cookiecutter-django/pull/5236))
- Update sphinx to 7.4.7 ([#5235](https://github.com/cookiecutter/cookiecutter-django/pull/5235))
## 2024.07.20
### Updated
- Update hiredis to 3.0.0 ([#5228](https://github.com/cookiecutter/cookiecutter-django/pull/5228))
- Update uvicorn to 0.30.3 ([#5234](https://github.com/cookiecutter/cookiecutter-django/pull/5234))
- Update django-crispy-forms to 2.3 ([#5229](https://github.com/cookiecutter/cookiecutter-django/pull/5229))
- Auto-update pre-commit hooks ([#5232](https://github.com/cookiecutter/cookiecutter-django/pull/5232))
## 2024.07.19
### Changed
- Use &#34;ENV key=value&#34; instead of &#34;ENV key value&#34; in Dockerfiles ([#5225](https://github.com/cookiecutter/cookiecutter-django/pull/5225))
### Updated
- Update django-upgrade to 1.20.0 ([#5227](https://github.com/cookiecutter/cookiecutter-django/pull/5227))
- Update ruff to 0.5.3 ([#5224](https://github.com/cookiecutter/cookiecutter-django/pull/5224))
## 2024.07.18
### Updated
- Update sphinx to 7.4.6 ([#5223](https://github.com/cookiecutter/cookiecutter-django/pull/5223))
## 2024.07.17

View File

@ -852,6 +852,13 @@ Listed in alphabetical order.
</td>
<td></td>
</tr>
<tr>
<td>Filipe Nascimento</td>
<td>
<a href="https://github.com/FilipeNas">FilipeNas</a>
</td>
<td></td>
</tr>
<tr>
<td>Florian Idelberger</td>
<td>

View File

@ -19,7 +19,7 @@ production-ready Django projects quickly.
## Features
- For Django 4.2
- For Django 5.0
- Works with Python 3.12
- Renders Django projects with 100% starting test coverage
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
@ -67,7 +67,7 @@ Projects that provide financial support to the maintainers:
### Two Scoops of Django
[![Cover of the book "Two Scoops of Django 3.x"](https://www.feldroy.com/static/book-TSD3-800.jpg)](https://www.feldroy.com/two-scoops-press#two-scoops-of-django)
[![Cover of the book "Two Scoops of Django 3.x"](https://f004.backblazeb2.com/file/feldroycom/images/book-TSD3-800.jpg)](https://www.feldroy.com/two-scoops-press#two-scoops-of-django)
Two Scoops of Django 3.x is the best ice cream-themed Django reference in the universe!
@ -244,6 +244,7 @@ experience better.
## Articles
- [Why cookiecutter-django is Essential for Your Next Django Project](https://medium.com/@millsks/why-cookiecutter-django-is-essential-for-your-next-django-project-7d3c00cdce51) - Aug. 4, 2024
- [How to Make Your Own Django Cookiecutter Template!](https://medium.com/@FatemeFouladkar/how-to-make-your-own-django-cookiecutter-template-a753d4cbb8c2) - Aug. 10, 2023
- [Cookiecutter Django With Amazon RDS](https://haseeburrehman.com/posts/cookiecutter-django-with-amazon-rds/) - Apr, 2, 2021
- [Complete Walkthrough: Blue/Green Deployment to AWS ECS using GitHub actions](https://github.com/Andrew-Chen-Wang/cookiecutter-django-ecs-github) - June 10, 2020

View File

@ -1,3 +1,3 @@
sphinx==7.4.5
sphinx==7.4.7
sphinx-rtd-theme==2.0.0
myst-parser==3.0.1
myst-parser==4.0.0

View File

@ -4,15 +4,15 @@ binaryornot==0.4.4
# Code quality
# ------------------------------------------------------------------------------
ruff==0.5.2
django-upgrade==1.19.0
ruff==0.5.6
django-upgrade==1.20.0
djlint==1.34.1
pre-commit==3.7.1
pre-commit==3.8.0
# Testing
# ------------------------------------------------------------------------------
tox==4.16.0
pytest==8.2.2
pytest==8.3.2
pytest-xdist==3.6.1
pytest-cookies==0.7.0
pytest-instafail==0.5.0

View File

@ -5,7 +5,7 @@ except ImportError:
from distutils.core import setup
# We use calendar versioning
version = "2024.07.17"
version = "2024.08.04"
with open("README.md") as readme_file:
long_description = readme_file.read()
@ -24,7 +24,7 @@ setup(
classifiers=[
"Development Status :: 4 - Beta",
"Environment :: Console",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: BSD License",

View File

@ -230,7 +230,7 @@ def test_django_upgrade_passes(cookies, context_override):
try:
sh.django_upgrade(
"--target-version",
"4.2",
"5.0",
*python_files,
_cwd=str(result.project_path),
)

View File

@ -28,14 +28,14 @@ repos:
exclude: '{{cookiecutter.project_slug}}/templates/'
- repo: https://github.com/adamchainz/django-upgrade
rev: '1.19.0'
rev: '1.20.0'
hooks:
- id: django-upgrade
args: ['--target-version', '4.2']
args: ['--target-version', '5.0']
# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
rev: v0.5.6
hooks:
# Linter
- id: ruff

View File

@ -27,9 +27,9 @@ FROM python AS python-run-stage
ARG BUILD_ENVIRONMENT=local
ARG APP_HOME=/app
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT}
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV BUILD_ENV=${BUILD_ENVIRONMENT}
WORKDIR ${APP_HOME}

View File

@ -5,7 +5,7 @@ FROM docker.io/python:3.12.4-slim-bookworm AS python
# Python build stage
FROM python AS python-build-stage
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONDONTWRITEBYTECODE=1
RUN apt-get update && apt-get install --no-install-recommends -y \
# dependencies for building Python packages
@ -29,8 +29,8 @@ RUN pip wheel --no-cache-dir --wheel-dir /usr/src/app/wheels \
FROM python AS python-run-stage
ARG BUILD_ENVIRONMENT
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
RUN apt-get update && apt-get install --no-install-recommends -y \
# To run the Makefile

View File

@ -6,4 +6,4 @@ COPY ./package.json /app
RUN npm install && npm cache clean --force
ENV PATH ./node_modules/.bin/:$PATH
ENV PATH=./node_modules/.bin/:$PATH

View File

@ -2,6 +2,7 @@ FROM docker.io/amazon/aws-cli:2.17.0
# Clear entrypoint from the base image, otherwise it's always calling the aws CLI
ENTRYPOINT []
CMD ["/bin/bash"]
COPY ./compose/production/aws/maintenance /usr/local/bin/maintenance
COPY ./compose/production/postgres/maintenance/_sourced /usr/local/bin/maintenance/_sourced

View File

@ -53,9 +53,9 @@ FROM python AS python-run-stage
ARG BUILD_ENVIRONMENT=production
ARG APP_HOME=/app
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1
ENV BUILD_ENV ${BUILD_ENVIRONMENT}
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV BUILD_ENV=${BUILD_ENVIRONMENT}
WORKDIR ${APP_HOME}

View File

@ -11,9 +11,9 @@ argon2-cffi==23.1.0 # https://github.com/hynek/argon2_cffi
{%- if cookiecutter.use_whitenoise == 'y' %}
whitenoise==6.7.0 # https://github.com/evansd/whitenoise
{%- endif %}
redis==5.0.7 # https://github.com/redis/redis-py
redis==5.0.8 # https://github.com/redis/redis-py
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
hiredis==2.3.2 # https://github.com/redis/hiredis-py
hiredis==3.0.0 # https://github.com/redis/hiredis-py
{%- endif %}
{%- if cookiecutter.use_celery == "y" %}
celery==5.4.0 # pyup: < 6.0 # https://github.com/celery/celery
@ -23,20 +23,20 @@ flower==2.0.1 # https://github.com/mher/flower
{%- endif %}
{%- endif %}
{%- if cookiecutter.use_async == 'y' %}
uvicorn[standard]==0.30.1 # https://github.com/encode/uvicorn
uvicorn[standard]==0.30.5 # https://github.com/encode/uvicorn
uvicorn-worker==0.2.0 # https://github.com/Kludex/uvicorn-worker
{%- endif %}
# Django
# ------------------------------------------------------------------------------
django==4.2.14 # pyup: < 5.0 # https://www.djangoproject.com/
django==5.0.7 # pyup: < 5.1 # https://www.djangoproject.com/
django-environ==0.11.2 # https://github.com/joke2k/django-environ
django-model-utils==4.5.1 # https://github.com/jazzband/django-model-utils
django-allauth[mfa]==0.63.6 # https://github.com/pennersr/django-allauth
django-crispy-forms==2.2 # https://github.com/django-crispy-forms/django-crispy-forms
django-allauth[mfa]==64.0.0 # https://github.com/pennersr/django-allauth
django-crispy-forms==2.3 # https://github.com/django-crispy-forms/django-crispy-forms
crispy-bootstrap5==2024.2 # https://github.com/django-crispy-forms/crispy-bootstrap5
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
django-compressor==4.5 # https://github.com/django-compressor/django-compressor
django-compressor==4.5.1 # https://github.com/django-compressor/django-compressor
{%- endif %}
django-redis==5.4.0 # https://github.com/jazzband/django-redis
{%- if cookiecutter.use_drf == 'y' %}

View File

@ -8,30 +8,30 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg
psycopg[binary]==3.2.1 # https://github.com/psycopg/psycopg
{%- endif %}
{%- if cookiecutter.use_async == 'y' or cookiecutter.use_celery == 'y' %}
watchfiles==0.22.0 # https://github.com/samuelcolvin/watchfiles
watchfiles==0.21.0 # https://github.com/samuelcolvin/watchfiles
{%- endif %}
# Testing
# ------------------------------------------------------------------------------
mypy==1.10.0 # https://github.com/python/mypy
django-stubs[compatible-mypy]==5.0.2 # https://github.com/typeddjango/django-stubs
pytest==8.2.2 # https://github.com/pytest-dev/pytest
mypy==1.11.1 # https://github.com/python/mypy
django-stubs[compatible-mypy]==5.0.4 # https://github.com/typeddjango/django-stubs
pytest==8.3.2 # https://github.com/pytest-dev/pytest
pytest-sugar==1.0.0 # https://github.com/Frozenball/pytest-sugar
{%- if cookiecutter.use_drf == "y" %}
djangorestframework-stubs[compatible-mypy]==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs
djangorestframework-stubs==3.15.0 # https://github.com/typeddjango/djangorestframework-stubs
{%- endif %}
# Documentation
# ------------------------------------------------------------------------------
sphinx==7.4.5 # https://github.com/sphinx-doc/sphinx
sphinx==7.4.7 # https://github.com/sphinx-doc/sphinx
sphinx-autobuild==2024.4.16 # https://github.com/GaretJax/sphinx-autobuild
# Code quality
# ------------------------------------------------------------------------------
ruff==0.5.2 # https://github.com/astral-sh/ruff
coverage==7.6.0 # https://github.com/nedbat/coveragepy
ruff==0.5.6 # https://github.com/astral-sh/ruff
coverage==7.6.1 # https://github.com/nedbat/coveragepy
djlint==1.34.1 # https://github.com/Riverside-Healthcare/djLint
pre-commit==3.7.1 # https://github.com/pre-commit/pre-commit
pre-commit==3.8.0 # https://github.com/pre-commit/pre-commit
# Django
# ------------------------------------------------------------------------------

View File

@ -8,10 +8,10 @@ psycopg[c]==3.2.1 # https://github.com/psycopg/psycopg
Collectfasta==3.2.0 # https://github.com/jasongi/collectfasta
{%- endif %}
{%- if cookiecutter.use_sentry == "y" %}
sentry-sdk==2.10.0 # https://github.com/getsentry/sentry-python
sentry-sdk==2.12.0 # https://github.com/getsentry/sentry-python
{%- endif %}
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
hiredis==2.3.2 # https://github.com/redis/hiredis-py
hiredis==3.0.0 # https://github.com/redis/hiredis-py
{%- endif %}
# Django

View File

@ -1 +1 @@
python-3.12.3
python-3.12.4

View File

@ -1,5 +1,6 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.messages.views import SuccessMessageMixin
from django.db.models import QuerySet
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django.views.generic import DetailView
@ -28,12 +29,12 @@ class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
fields = ["name"]
success_message = _("Information successfully updated")
def get_success_url(self):
# for mypy to know that the user is authenticated
assert self.request.user.is_authenticated
def get_success_url(self) -> str:
assert self.request.user.is_authenticated # type guard
return self.request.user.get_absolute_url()
def get_object(self):
def get_object(self, queryset: QuerySet | None=None) -> User:
assert self.request.user.is_authenticated # type guard
return self.request.user
@ -43,7 +44,7 @@ user_update_view = UserUpdateView.as_view()
class UserRedirectView(LoginRequiredMixin, RedirectView):
permanent = False
def get_redirect_url(self):
def get_redirect_url(self) -> str:
{%- if cookiecutter.username_type == "email" %}
return reverse("users:detail", kwargs={"pk": self.request.user.pk})
{%- else %}