Merge branch 'master' into master

This commit is contained in:
Bruno Alla 2023-06-28 13:02:51 +01:00 committed by GitHub
commit 18bf5a461b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 830 additions and 512 deletions

9
.github/FUNDING.yml vendored
View File

@ -2,11 +2,4 @@
github: [pydanny, browniebroke] github: [pydanny, browniebroke]
patreon: feldroy patreon: feldroy
open_collective: # Replace with a single Open Collective username open_collective: cookiecutter-django
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ["https://www.patreon.com/browniebroke"]

View File

@ -53,6 +53,12 @@
"twitter_username": "sfdye", "twitter_username": "sfdye",
"is_core": true "is_core": true
}, },
{
"name": "Jelmer Draaijer",
"github_login": "foarsitter",
"twitter_username": "",
"is_core": true
},
{ {
"name": "18", "name": "18",
"github_login": "dezoito", "github_login": "dezoito",
@ -553,11 +559,6 @@
"github_login": "jvanbrug", "github_login": "jvanbrug",
"twitter_username": "" "twitter_username": ""
}, },
{
"name": "Jelmer Draaijer",
"github_login": "foarsitter",
"twitter_username": ""
},
{ {
"name": "Jerome Caisip", "name": "Jerome Caisip",
"github_login": "jeromecaisip", "github_login": "jeromecaisip",

View File

@ -23,7 +23,7 @@ repos:
args: ["--tab-width", "2"] args: ["--tab-width", "2"]
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.4.0 rev: v3.7.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py311-plus] args: [--py311-plus]

View File

@ -3,6 +3,117 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER --> <!-- GENERATOR_PLACEHOLDER -->
## 2023.06.27
### Changed
- Populate User `name` field during social auth ([#3968](https://github.com/cookiecutter/cookiecutter-django/pull/3968))
- Add djLint for HTML formatting and linting ([#4389](https://github.com/cookiecutter/cookiecutter-django/pull/4389))
### Fixed
- Only include prettier pre-commit hook with node-based front-end pipeline ([#4418](https://github.com/cookiecutter/cookiecutter-django/pull/4418))
### Updated
- Update djangorestframework-stubs to 3.14.2 ([#4420](https://github.com/cookiecutter/cookiecutter-django/pull/4420))
- Update django-stubs to 4.2.2 ([#4419](https://github.com/cookiecutter/cookiecutter-django/pull/4419))
## 2023.06.26
### Updated
- Update pytest to 7.4.0 ([#4412](https://github.com/cookiecutter/cookiecutter-django/pull/4412))
- Update redis to 4.6.0 ([#4415](https://github.com/cookiecutter/cookiecutter-django/pull/4415))
- Update mypy to 1.4.1 ([#4416](https://github.com/cookiecutter/cookiecutter-django/pull/4416))
## 2023.06.22
### Updated
- Update pygithub to 1.59.0 ([#4410](https://github.com/cookiecutter/cookiecutter-django/pull/4410))
- Update drf-spectacular to 0.26.3 ([#4411](https://github.com/cookiecutter/cookiecutter-django/pull/4411))
- Update sentry-sdk to 1.26.0 ([#4409](https://github.com/cookiecutter/cookiecutter-django/pull/4409))
## 2023.06.21
### Updated
- Upgrade traefik to 2.10.3 ([#4408](https://github.com/cookiecutter/cookiecutter-django/pull/4408))
## 2023.06.19
### Updated
- Auto-update pre-commit hooks ([#4405](https://github.com/cookiecutter/cookiecutter-django/pull/4405))
- Update celery to 5.3.1 ([#4404](https://github.com/cookiecutter/cookiecutter-django/pull/4404))
## 2023.06.18
### Changed
- Fix missing celery env variable when running compilemessages ([#4403](https://github.com/cookiecutter/cookiecutter-django/pull/4403))
### Updated
- Update flower to 2.0.0 ([#4402](https://github.com/cookiecutter/cookiecutter-django/pull/4402))
## 2023.06.17
## 2023.06.16
### Updated
- Update whitenoise to 6.5.0 ([#4400](https://github.com/cookiecutter/cookiecutter-django/pull/4400))
- Update django-redis to 5.3.0 ([#4399](https://github.com/cookiecutter/cookiecutter-django/pull/4399))
- Auto-update pre-commit hooks ([#4395](https://github.com/cookiecutter/cookiecutter-django/pull/4395))
## 2023.06.14
### Updated
- Update django-cors-headers to 4.1.0 ([#4391](https://github.com/cookiecutter/cookiecutter-django/pull/4391))
- Update django-upgrade to 1.14.0 ([#4394](https://github.com/cookiecutter/cookiecutter-django/pull/4394))
- Update django-webpack-loader to 2.0.1 ([#4392](https://github.com/cookiecutter/cookiecutter-django/pull/4392))
- Update pre-commit to 3.3.3 ([#4390](https://github.com/cookiecutter/cookiecutter-django/pull/4390))
## 2023.06.11
### Updated
- Update pytest to 7.3.2 ([#4384](https://github.com/cookiecutter/cookiecutter-django/pull/4384))
- Auto-update pre-commit hooks ([#4385](https://github.com/cookiecutter/cookiecutter-django/pull/4385))
## 2023.06.09
### Fixed
- Fix missing `compilemessages` step before deploying to prod ([#4363](https://github.com/cookiecutter/cookiecutter-django/pull/4363))
## 2023.06.08 ## 2023.06.08

View File

@ -74,6 +74,13 @@ accept and merge pull requests.
</td> </td>
<td>sfdye</td> <td>sfdye</td>
</tr> </tr>
<tr>
<td>Jelmer Draaijer</td>
<td>
<a href="https://github.com/foarsitter">foarsitter</a>
</td>
<td></td>
</tr>
</table> </table>
_Audrey is also the creator of Cookiecutter. Audrey and Daniel are on _Audrey is also the creator of Cookiecutter. Audrey and Daniel are on
@ -1006,13 +1013,6 @@ Listed in alphabetical order.
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>Jelmer Draaijer</td>
<td>
<a href="https://github.com/foarsitter">foarsitter</a>
</td>
<td></td>
</tr>
<tr> <tr>
<td>Jens Nilsson</td> <td>Jens Nilsson</td>
<td> <td>

View File

@ -19,7 +19,7 @@ production-ready Django projects quickly.
## Features ## Features
- For Django 4.1 - For Django 4.2
- Works with Python 3.11 - Works with Python 3.11
- Renders Django projects with 100% starting test coverage - Renders Django projects with 100% starting test coverage
- Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5 - Twitter [Bootstrap](https://github.com/twbs/bootstrap) v5
@ -56,10 +56,11 @@ _These features can be enabled during initial project setup._
## Support this Project! ## Support this Project!
This project is run by volunteers. Please support them in their efforts to maintain and improve Cookiecutter Django: This project is an open source project run by volunteers. You can sponsor us via [OpenCollective](https://opencollective.com/cookiecutter-django) or individually via GitHub Sponsors:
- Daniel Roy Greenfeld, Project Lead ([GitHub](https://github.com/pydanny), [Patreon](https://www.patreon.com/danielroygreenfeld)): expertise in Django and AWS ELB. - Daniel Roy Greenfeld, Project Lead ([GitHub](https://github.com/pydanny), [Patreon](https://www.patreon.com/danielroygreenfeld)): expertise in Django and AWS ELB.
- Fabio C. Barrionuevo, Core Developer ([GitHub](https://github.com/luzfcb)): expertise in Python/Django, hands-on DevOps and frontend experience. - Fabio C. Barrionuevo, Core Developer ([GitHub](https://github.com/luzfcb)): expertise in Python/Django, hands-on DevOps and frontend experience.
- Bruno Alla, Core Developer ([GitHub](https://github.com/browniebroke)): expertise in Python/Django and DevOps.
- Nikita Shupeyko, Core Developer ([GitHub](https://github.com/webyneter)): expertise in Python/Django, hands-on DevOps and frontend experience. - Nikita Shupeyko, Core Developer ([GitHub](https://github.com/webyneter)): expertise in Python/Django, hands-on DevOps and frontend experience.
Projects that provide financial support to the maintainers: Projects that provide financial support to the maintainers:

View File

@ -1,3 +1,3 @@
sphinx==6.2.1 sphinx==6.2.1
sphinx-rtd-theme==1.2.2 sphinx-rtd-theme==1.2.2
myst-parser==1.0.0 myst-parser==2.0.0

View File

@ -27,3 +27,24 @@ known_first_party = [
"scripts", "scripts",
"hooks", "hooks",
] ]
# ==== djLint ====
[tool.djlint]
blank_line_after_tag = "load,extends"
close_void_tags = true
format_css = true
format_js = true
# TODO: remove T002 when fixed https://github.com/Riverside-Healthcare/djLint/issues/687
ignore = "H006,H030,H031,T002,T028"
ignore_blocks = "raw"
include = "H017,H035"
indent = 2
max_line_length = 119
profile = "jinja"
[tool.djlint.css]
indent_size = 2
[tool.djlint.js]
indent_size = 2

View File

@ -7,13 +7,14 @@ binaryornot==0.4.4
black==23.3.0 black==23.3.0
isort==5.12.0 isort==5.12.0
flake8==6.0.0 flake8==6.0.0
django-upgrade==1.13.0 django-upgrade==1.14.0
pre-commit==3.3.2 djlint==1.31.1
pre-commit==3.3.3
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
tox==4.6.0 tox==4.6.3
pytest==7.3.1 pytest==7.4.0
pytest-xdist==3.3.1 pytest-xdist==3.3.1
pytest-cookies==0.7.0 pytest-cookies==0.7.0
pytest-instafail==0.5.0 pytest-instafail==0.5.0
@ -21,7 +22,7 @@ pyyaml==6.0
# Scripting # Scripting
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
PyGithub==1.58.2 PyGithub==1.59.0
gitpython==3.1.31 gitpython==3.1.31
jinja2==3.1.2 jinja2==3.1.2
requests==2.31.0 requests==2.31.0

View File

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

View File

@ -232,7 +232,7 @@ def test_django_upgrade_passes(cookies, context_override):
try: try:
sh.django_upgrade( sh.django_upgrade(
"--target-version", "--target-version",
"4.1", "4.2",
*python_files, *python_files,
_cwd=str(result.project_path), _cwd=str(result.project_path),
) )
@ -240,6 +240,32 @@ def test_django_upgrade_passes(cookies, context_override):
pytest.fail(e.stdout.decode()) pytest.fail(e.stdout.decode())
@pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)
def test_djlint_lint_passes(cookies, context_override):
"""Check whether generated project passes djLint --lint."""
result = cookies.bake(extra_context=context_override)
autofixable_rules = "H014,T001"
# TODO: remove T002 when fixed https://github.com/Riverside-Healthcare/djLint/issues/687
ignored_rules = "H006,H030,H031,T002"
try:
sh.djlint("--lint", "--ignore", f"{autofixable_rules},{ignored_rules}", ".", _cwd=str(result.project_path))
except sh.ErrorReturnCode as e:
pytest.fail(e.stdout.decode())
@auto_fixable
@pytest.mark.parametrize("context_override", SUPPORTED_COMBINATIONS, ids=_fixture_id)
def test_djlint_check_passes(cookies, context_override):
"""Check whether generated project passes djLint --check."""
result = cookies.bake(extra_context=context_override)
try:
sh.djlint("--check", ".", _cwd=str(result.project_path))
except sh.ErrorReturnCode as e:
pytest.fail(e.stdout.decode())
@pytest.mark.parametrize( @pytest.mark.parametrize(
["use_docker", "expected_test_script"], ["use_docker", "expected_test_script"],
[ [

View File

@ -16,6 +16,7 @@ repos:
- id: check-case-conflict - id: check-case-conflict
- id: check-docstring-first - id: check-docstring-first
- id: detect-private-key - id: detect-private-key
{%- if cookiecutter.frontend_pipeline in ["Webpack", "Gulp"] %}
- repo: https://github.com/pre-commit/mirrors-prettier - repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0-alpha.9-for-vscode rev: v3.0.0-alpha.9-for-vscode
@ -23,15 +24,16 @@ repos:
- id: prettier - id: prettier
args: ['--tab-width', '2', '--single-quote'] args: ['--tab-width', '2', '--single-quote']
exclude: '{{cookiecutter.project_slug}}/templates/' exclude: '{{cookiecutter.project_slug}}/templates/'
{%- endif %}
- repo: https://github.com/adamchainz/django-upgrade - repo: https://github.com/adamchainz/django-upgrade
rev: '1.13.0' rev: '1.14.0'
hooks: hooks:
- id: django-upgrade - id: django-upgrade
args: ['--target-version', '4.1'] args: ['--target-version', '4.2']
- repo: https://github.com/asottile/pyupgrade - repo: https://github.com/asottile/pyupgrade
rev: v3.4.0 rev: v3.7.0
hooks: hooks:
- id: pyupgrade - id: pyupgrade
args: [--py311-plus] args: [--py311-plus]
@ -51,6 +53,12 @@ repos:
hooks: hooks:
- id: flake8 - id: flake8
- repo: https://github.com/Riverside-Healthcare/djLint
rev: v1.31.1
hooks:
- id: djlint-reformat-django
- id: djlint-django
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date # sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci: ci:
autoupdate_schedule: weekly autoupdate_schedule: weekly

View File

@ -122,6 +122,9 @@ RUN chown django:django ${APP_HOME}
USER django USER django
RUN DATABASE_URL="" \ RUN DATABASE_URL="" \
{%- if cookiecutter.use_celery == "y" %}
CELERY_BROKER_URL="" \
{%- endif %}
DJANGO_SETTINGS_MODULE="config.settings.test" \ DJANGO_SETTINGS_MODULE="config.settings.test" \
python manage.py compilemessages python manage.py compilemessages

View File

@ -1,4 +1,4 @@
FROM traefik:2.10.1 FROM traefik:2.10.3
RUN mkdir -p /etc/traefik/acme \ RUN mkdir -p /etc/traefik/acme \
&& touch /etc/traefik/acme/acme.json \ && touch /etc/traefik/acme/acme.json \
&& chmod 600 /etc/traefik/acme/acme.json && chmod 600 /etc/traefik/acme/acme.json

View File

@ -90,3 +90,23 @@ generated-members = [
"save", "save",
"delete", "delete",
] ]
# ==== djLint ====
[tool.djlint]
blank_line_after_tag = "load,extends"
close_void_tags = true
format_css = true
format_js = true
# TODO: remove T002 when fixed https://github.com/Riverside-Healthcare/djLint/issues/687
ignore = "H006,H030,H031,T002"
include = "H017,H035"
indent = 2
max_line_length = 119
profile = "django"
[tool.djlint.css]
indent_size = 2
[tool.djlint.js]
indent_size = 2

View File

@ -9,17 +9,17 @@ rcssmin==1.1.1 # https://github.com/ndparker/rcssmin
{%- endif %} {%- endif %}
argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi argon2-cffi==21.3.0 # https://github.com/hynek/argon2_cffi
{%- if cookiecutter.use_whitenoise == 'y' %} {%- if cookiecutter.use_whitenoise == 'y' %}
whitenoise==6.4.0 # https://github.com/evansd/whitenoise whitenoise==6.5.0 # https://github.com/evansd/whitenoise
{%- endif %} {%- endif %}
redis==4.5.5 # https://github.com/redis/redis-py redis==4.6.0 # https://github.com/redis/redis-py
{%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %} {%- if cookiecutter.use_docker == "y" or cookiecutter.windows == "n" %}
hiredis==2.2.3 # https://github.com/redis/hiredis-py hiredis==2.2.3 # https://github.com/redis/hiredis-py
{%- endif %} {%- endif %}
{%- if cookiecutter.use_celery == "y" %} {%- if cookiecutter.use_celery == "y" %}
celery==5.3.0 # pyup: < 6.0 # https://github.com/celery/celery celery==5.3.1 # pyup: < 6.0 # https://github.com/celery/celery
django-celery-beat==2.5.0 # https://github.com/celery/django-celery-beat django-celery-beat==2.5.0 # https://github.com/celery/django-celery-beat
{%- if cookiecutter.use_docker == 'y' %} {%- if cookiecutter.use_docker == 'y' %}
flower==1.2.0 # https://github.com/mher/flower flower==2.0.0 # https://github.com/mher/flower
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- if cookiecutter.use_async == 'y' %} {%- if cookiecutter.use_async == 'y' %}
@ -28,23 +28,23 @@ uvicorn[standard]==0.22.0 # https://github.com/encode/uvicorn
# Django # Django
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
django==4.1.9 # pyup: < 4.2 # https://www.djangoproject.com/ django==4.2.2 # pyup: < 5.0 # https://www.djangoproject.com/
django-environ==0.10.0 # https://github.com/joke2k/django-environ django-environ==0.10.0 # https://github.com/joke2k/django-environ
django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils django-model-utils==4.3.1 # https://github.com/jazzband/django-model-utils
django-allauth==0.54.0 # https://github.com/pennersr/django-allauth django-allauth==0.54.0 # https://github.com/pennersr/django-allauth
django-crispy-forms==2.0 # https://github.com/django-crispy-forms/django-crispy-forms django-crispy-forms==2.0 # https://github.com/django-crispy-forms/django-crispy-forms
crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5 crispy-bootstrap5==0.7 # https://github.com/django-crispy-forms/crispy-bootstrap5
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %} {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}
django-compressor==4.3.1 # https://github.com/django-compressor/django-compressor django-compressor==4.4 # https://github.com/django-compressor/django-compressor
{%- endif %} {%- endif %}
django-redis==5.2.0 # https://github.com/jazzband/django-redis django-redis==5.3.0 # https://github.com/jazzband/django-redis
{%- if cookiecutter.use_drf == 'y' %} {%- if cookiecutter.use_drf == 'y' %}
# Django REST Framework # Django REST Framework
djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework djangorestframework==3.14.0 # https://github.com/encode/django-rest-framework
django-cors-headers==4.0.0 # https://github.com/adamchainz/django-cors-headers django-cors-headers==4.1.0 # https://github.com/adamchainz/django-cors-headers
# DRF-spectacular for api documentation # DRF-spectacular for api documentation
drf-spectacular==0.26.2 # https://github.com/tfranzel/drf-spectacular drf-spectacular==0.26.3 # https://github.com/tfranzel/drf-spectacular
{%- endif %} {%- endif %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %} {%- if cookiecutter.frontend_pipeline == 'Webpack' %}
django-webpack-loader==2.0.0 # https://github.com/django-webpack/django-webpack-loader django-webpack-loader==2.0.1 # https://github.com/django-webpack/django-webpack-loader
{%- endif %} {%- endif %}

View File

@ -13,12 +13,12 @@ watchfiles==0.19.0 # https://github.com/samuelcolvin/watchfiles
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
mypy==1.3.0 # https://github.com/python/mypy mypy==1.4.1 # https://github.com/python/mypy
django-stubs==4.2.1 # https://github.com/typeddjango/django-stubs django-stubs==4.2.2 # https://github.com/typeddjango/django-stubs
pytest==7.3.1 # https://github.com/pytest-dev/pytest pytest==7.4.0 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.7 # https://github.com/Frozenball/pytest-sugar pytest-sugar==0.9.7 # https://github.com/Frozenball/pytest-sugar
{%- if cookiecutter.use_drf == "y" %} {%- if cookiecutter.use_drf == "y" %}
djangorestframework-stubs==3.14.1 # https://github.com/typeddjango/djangorestframework-stubs djangorestframework-stubs==3.14.2 # https://github.com/typeddjango/djangorestframework-stubs
{%- endif %} {%- endif %}
# Documentation # Documentation
@ -32,11 +32,12 @@ flake8==6.0.0 # https://github.com/PyCQA/flake8
flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort flake8-isort==6.0.0 # https://github.com/gforcada/flake8-isort
coverage==7.2.7 # https://github.com/nedbat/coveragepy coverage==7.2.7 # https://github.com/nedbat/coveragepy
black==23.3.0 # https://github.com/psf/black black==23.3.0 # https://github.com/psf/black
djlint==1.31.1 # https://github.com/Riverside-Healthcare/djLint
pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django pylint-django==2.5.3 # https://github.com/PyCQA/pylint-django
{%- if cookiecutter.use_celery == 'y' %} {%- if cookiecutter.use_celery == 'y' %}
pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery pylint-celery==0.3 # https://github.com/PyCQA/pylint-celery
{%- endif %} {%- endif %}
pre-commit==3.3.2 # https://github.com/pre-commit/pre-commit pre-commit==3.3.3 # https://github.com/pre-commit/pre-commit
# Django # Django
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@ -8,7 +8,7 @@ psycopg2==2.9.6 # https://github.com/psycopg/psycopg2
Collectfast==2.2.0 # https://github.com/antonagestam/collectfast Collectfast==2.2.0 # https://github.com/antonagestam/collectfast
{%- endif %} {%- endif %}
{%- if cookiecutter.use_sentry == "y" %} {%- if cookiecutter.use_sentry == "y" %}
sentry-sdk==1.25.1 # https://github.com/getsentry/sentry-python sentry-sdk==1.26.0 # https://github.com/getsentry/sentry-python
{%- endif %} {%- endif %}
{%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %} {%- if cookiecutter.use_docker == "n" and cookiecutter.windows == "y" %}
hiredis==2.2.3 # https://github.com/redis/hiredis-py hiredis==2.2.3 # https://github.com/redis/hiredis-py

View File

@ -1,10 +1,14 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}Forbidden (403){% endblock %} {% block title %}Forbidden (403){% endblock title %}
{% block content %} {% block content %}
<h1>Forbidden (403)</h1> <h1>Forbidden (403)</h1>
<p>
<p>{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}</p> {% if exception %}
{{ exception }}
{% else %}
You're not allowed to access this page.
{% endif %}
</p>
{% endblock content %} {% endblock content %}
{%- endraw %} {%- endraw %}

View File

@ -1,10 +1,14 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}Page not found{% endblock %} {% block title %}Page not found{% endblock title %}
{% block content %} {% block content %}
<h1>Page not found</h1> <h1>Page not found</h1>
<p>
<p>{% if exception %}{{ exception }}{% else %}This is not the page you were looking for.{% endif %}</p> {% if exception %}
{{ exception }}
{% else %}
This is not the page you were looking for.
{% endif %}
</p>
{% endblock content %} {% endblock content %}
{%- endraw %} {%- endraw %}

View File

@ -1,12 +1,11 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}Server Error{% endblock %} {% block title %}Server Error{% endblock title %}
{% block content %} {% block content %}
<h1>Ooops!!! 500</h1> <h1>Ooops!!! 500</h1>
<h3>Looks like something went wrong!</h3>
<h3>Looks like something went wrong!</h3> <p>
We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.
<p>We track these errors automatically, but if the problem persists feel free to contact us. In the meantime, try refreshing.</p> </p>
{% endblock content %} {% endblock content %}
{%- endraw %} {%- endraw %}

View File

@ -2,11 +2,11 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Account Inactive" %}{% endblock %} {% block head_title %}
{% translate "Account Inactive" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Account Inactive" %}</h1> <h1>{% translate "Account Inactive" %}</h1>
<p>{% translate "This account is inactive." %}</p>
<p>{% translate "This account is inactive." %}</p> {% endblock inner %}
{% endblock %}
{%- endraw %} {%- endraw %}

View File

@ -1,11 +1,14 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% block title %}{% block head_title %}{% endblock head_title %}{% endblock title %}
{% block title %}
{% block head_title %}
{% endblock head_title %}
{% endblock title %}
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-md-6 offset-md-3"> <div class="col-md-6 offset-md-3">
{% block inner %}{% endblock %} {% block inner %}{% endblock inner %}
</div>
</div> </div>
</div> {% endblock content %}
{% endblock %}
{%- endraw %} {%- endraw %}

View File

@ -4,76 +4,77 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Account" %}{% endblock %} {% block head_title %}
{% translate "Account" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "E-mail Addresses" %}</h1> <h1>{% translate "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
{% if user.emailaddress_set.all %} <p>{% translate "The following e-mail addresses are associated with your account:" %}</p>
<p>{% translate 'The following e-mail addresses are associated with your account:' %}</p> <form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<form action="{% url 'account_email' %}" class="email_list" method="post"> <fieldset class="blockLabels">
{% csrf_token %} {% for emailaddress in user.emailaddress_set.all %}
<fieldset class="blockLabels"> <div class="radio">
<label for="email_radio_{{ forloop.counter }}"
{% for emailaddress in user.emailaddress_set.all %} class="{% if emailaddress.primary %}primary_email{% endif %}">
<div class="radio"> <input id="email_radio_{{ forloop.counter }}"
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}"> type="radio"
name="email"
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{%endif %} value="{{emailaddress.email}}"/> {% if emailaddress.primary or user.emailaddress_set.count == 1 %}checked="checked"{% endif %}
value="{{ emailaddress.email }}" />
{{ emailaddress.email }} {{ emailaddress.email }}
{% if emailaddress.verified %} {% if emailaddress.verified %}
<span class="verified">{% translate "Verified" %}</span> <span class="verified">{% translate "Verified" %}</span>
{% else %} {% else %}
<span class="unverified">{% translate "Unverified" %}</span> <span class="unverified">{% translate "Unverified" %}</span>
{% endif %} {% endif %}
{% if emailaddress.primary %}<span class="primary">{% translate "Primary" %}</span>{% endif %} {% if emailaddress.primary %}
</label> <span class="primary">{% translate "Primary" %}</span>
</div> {% endif %}
{% endfor %} </label>
</div>
<div class="form-group"> {% endfor %}
<button class="secondaryAction btn btn-primary" type="submit" name="action_primary" >{% translate 'Make Primary' %}</button> <div class="form-group">
<button class="secondaryAction btn btn-primary" type="submit" name="action_send" >{% translate 'Re-send Verification' %}</button> <button class="secondaryAction btn btn-primary"
<button class="primaryAction btn btn-primary" type="submit" name="action_remove" >{% translate 'Remove' %}</button> type="submit"
</div> name="action_primary">{% translate "Make Primary" %}</button>
<button class="secondaryAction btn btn-primary"
</fieldset> type="submit"
</form> name="action_send">{% translate "Re-send Verification" %}</button>
<button class="primaryAction btn btn-primary"
{% else %} type="submit"
<p><strong>{% translate 'Warning:'%}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p> name="action_remove">{% translate "Remove" %}</button>
</div>
{% endif %} </fieldset>
<h2>{% translate "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" name="action_add" type="submit">{% translate "Add E-mail" %}</button>
</form> </form>
{% else %}
{% endblock %} <p>
<strong>{% translate "Warning:" %}</strong> {% translate "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}
</p>
{% endif %}
<h2>{% translate "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" name="action_add" type="submit">{% translate "Add E-mail" %}</button>
</form>
{% endblock inner %}
{% block inline_javascript %} {% block inline_javascript %}
{{ block.super }} {{ block.super }}
<script type="text/javascript"> <script type="text/javascript">
window.addEventListener('DOMContentLoaded',function() { window.addEventListener('DOMContentLoaded', function() {
const message = "{% translate 'Do you really want to remove the selected e-mail address?' %}"; const message = "{% translate 'Do you really want to remove the selected e-mail address?' %}";
const actions = document.getElementsByName('action_remove'); const actions = document.getElementsByName('action_remove');
if (actions.length) { if (actions.length) {
actions[0].addEventListener("click",function(e) { actions[0].addEventListener("click", function(e) {
if (!confirm(message)) { if (!confirm(message)) {
e.preventDefault(); e.preventDefault();
}
});
} }
Array.from(document.getElementsByClassName('form-group')).forEach(x => x.classList.remove('row'));
}); });
} </script>
Array.from(document.getElementsByClassName('form-group')).forEach(x => x.classList.remove('row')); {% endblock inline_javascript %}
});
</script>
{% endblock %}
{%- endraw %} {%- endraw %}

View File

@ -3,30 +3,26 @@
{% load i18n %} {% load i18n %}
{% load account %} {% load account %}
{% block head_title %}{% translate "Confirm E-mail Address" %}{% endblock %} {% block head_title %}
{% translate "Confirm E-mail Address" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Confirm E-mail Address" %}</h1> <h1>{% translate "Confirm E-mail Address" %}</h1>
{% if confirmation %}
{% if confirmation %} {% user_display confirmation.email_address.user as user_display %}
<p>
{% user_display confirmation.email_address.user as user_display %} {% blocktranslate with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktranslate %}
</p>
<p>{% blocktranslate with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktranslate %}</p> <form method="post"
action="{% url 'account_confirm_email' confirmation.key %}">
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}"> {% csrf_token %}
{% csrf_token %} <button class="btn btn-primary" type="submit">{% translate "Confirm" %}</button>
<button class="btn btn-primary" type="submit">{% translate 'Confirm' %}</button> </form>
</form> {% else %}
{% url 'account_email' as email_url %}
{% else %} <p>
{% blocktranslate %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktranslate %}
{% url 'account_email' as email_url %} </p>
{% endif %}
<p>{% blocktranslate %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktranslate %}</p> {% endblock inner %}
{% endif %}
{% endblock %}
{%- endraw %} {%- endraw %}

View File

@ -4,57 +4,50 @@
{% load account socialaccount %} {% load account socialaccount %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Sign In" %}{% endblock %} {% block head_title %}
{% translate "Sign In" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Sign In" %}</h1>
<h1>{% translate "Sign In" %}</h1> {% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>
{% translate "Please sign in with one of your existing third party accounts:" %}
{% if ACCOUNT_ALLOW_REGISTRATION %}
{% blocktranslate trimmed %}
Or, <a href="{{ signup_url }}">sign up</a>
for a {{ site_name }} account and sign in below:
{% endblocktranslate %}
{% endif %}
</p>
<div class="socialaccount_ballot">
<ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
<div class="login-or">{% translate "or" %}</div>
</div>
{% include "socialaccount/snippets/login_extra.html" %}
{% else %}
{% if ACCOUNT_ALLOW_REGISTRATION %}
<p> <p>
{% blocktranslate trimmed %} {% translate "Please sign in with one of your existing third party accounts:" %}
If you have not created an account yet, then please {% if ACCOUNT_ALLOW_REGISTRATION %}
<a href="{{ signup_url }}">sign up</a> first. {% blocktranslate trimmed %}
{% endblocktranslate %} Or, <a href="{{ signup_url }}">sign up</a>
for a {{ site_name }} account and sign in below:
{% endblocktranslate %}
{% endif %}
</p> </p>
<div class="socialaccount_ballot">
<ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
<div class="login-or">{% translate "or" %}</div>
</div>
{% include "socialaccount/snippets/login_extra.html" %}
{% else %}
{% if ACCOUNT_ALLOW_REGISTRATION %}
<p>
{% blocktranslate trimmed %}
If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.
{% endblocktranslate %}
</p>
{% endif %}
{% endif %} {% endif %}
{% endif %} <form class="login" method="post" action="{% url 'account_login' %}">
{% csrf_token %}
<form class="login" method="POST" action="{% url 'account_login' %}"> {{ form|crispy }}
{% csrf_token %} {% if redirect_field_value %}
{{ form|crispy }} <input type="hidden"
{% if redirect_field_value %} name="{{ redirect_field_name }}"
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" /> value="{{ redirect_field_value }}" />
{% endif %} {% endif %}
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a> <a class="button secondaryAction"
<button class="primaryAction btn btn-primary" type="submit">{% translate "Sign In" %}</button> href="{% url 'account_reset_password' %}">{% translate "Forgot Password?" %}</a>
</form> <button class="primaryAction btn btn-primary" type="submit">{% translate "Sign In" %}</button>
</form>
{% endblock %} {% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -2,19 +2,20 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Sign Out" %}{% endblock %} {% block head_title %}
{% translate "Sign Out" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Sign Out" %}</h1> <h1>{% translate "Sign Out" %}</h1>
<p>{% translate "Are you sure you want to sign out?" %}</p>
<p>{% translate 'Are you sure you want to sign out?' %}</p> <form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
<form method="post" action="{% url 'account_logout' %}"> {% if redirect_field_value %}
{% csrf_token %} <input type="hidden"
{% if redirect_field_value %} name="{{ redirect_field_name }}"
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/> value="{{ redirect_field_value }}" />
{% endif %} {% endif %}
<button class="btn btn-danger" type="submit">{% translate 'Sign Out' %}</button> <button class="btn btn-danger" type="submit">{% translate "Sign Out" %}</button>
</form> </form>
{% endblock %} {% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -3,15 +3,17 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Change Password" %}{% endblock %} {% block head_title %}
{% translate "Change Password" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Change Password" %}</h1> <h1>{% translate "Change Password" %}</h1>
<form method="post"
<form method="POST" action="{% url 'account_change_password' %}" class="password_change"> action="{% url 'account_change_password' %}"
{% csrf_token %} class="password_change">
{{ form|crispy }} {% csrf_token %}
<button class="btn btn-primary" type="submit" name="action">{% translate "Change Password" %}</button> {{ form|crispy }}
</form> <button class="btn btn-primary" type="submit" name="action">{% translate "Change Password" %}</button>
{% endblock %} </form>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -4,23 +4,26 @@
{% load account %} {% load account %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Password Reset" %}{% endblock %} {% block head_title %}
{% translate "Password Reset" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Password Reset" %}</h1>
<h1>{% translate "Password Reset" %}</h1> {% if user.is_authenticated %}
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %} {% include "account/snippets/already_logged_in.html" %}
{% endif %} {% endif %}
<p>
<p>{% translate "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p> {% translate "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}
</p>
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset"> <form method="post"
{% csrf_token %} action="{% url 'account_reset_password' %}"
{{ form|crispy }} class="password_reset">
<input class="btn btn-primary" type="submit" value="{% translate 'Reset My Password' %}" /> {% csrf_token %}
</form> {{ form|crispy }}
<input class="btn btn-primary"
<p>{% blocktranslate %}Please contact us if you have any trouble resetting your password.{% endblocktranslate %}</p> type="submit"
{% endblock %} value="{% translate 'Reset My Password' %}" />
</form>
<p>{% blocktranslate %}Please contact us if you have any trouble resetting your password.{% endblocktranslate %}</p>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -3,15 +3,16 @@
{% load i18n %} {% load i18n %}
{% load account %} {% load account %}
{% block head_title %}{% translate "Password Reset" %}{% endblock %} {% block head_title %}
{% translate "Password Reset" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Password Reset" %}</h1> <h1>{% translate "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %} {% include "account/snippets/already_logged_in.html" %}
{% endif %} {% endif %}
<p>
<p>{% blocktranslate %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p> {% blocktranslate %}We have sent you an e-mail. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}
{% endblock %} </p>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -2,24 +2,36 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Change Password" %}{% endblock %}
{% block head_title %}
{% translate "Change Password" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% if token_fail %}{% translate "Bad Token" %}{% else %}{% translate "Change Password" %}{% endif %}</h1> <h1>
{% if token_fail %} {% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %} {% translate "Bad Token" %}
<p>{% blocktranslate %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktranslate %}</p>
{% else %} {% else %}
{% if form %} {% translate "Change Password" %}
<form method="POST" action=".">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'change password' %}"/>
</form>
{% else %}
<p>{% translate 'Your password is now changed.' %}</p>
{% endif %}
{% endif %} {% endif %}
{% endblock %} </h1>
{% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %}
<p>
{% blocktranslate %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktranslate %}
</p>
{% else %}
{% if form %}
<form method="post" action=".">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary"
type="submit"
name="action"
value="{% translate 'change password' %}" />
</form>
{% else %}
<p>{% translate "Your password is now changed." %}</p>
{% endif %}
{% endif %}
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -1,10 +1,12 @@
{% raw %}{% extends "account/base.html" %} {% raw %}{% extends "account/base.html" %}
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Change Password" %}{% endblock %}
{% block head_title %}
{% translate "Change Password" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Change Password" %}</h1> <h1>{% translate "Change Password" %}</h1>
<p>{% translate 'Your password is now changed.' %}</p> <p>{% translate "Your password is now changed." %}</p>
{% endblock %} {% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -3,15 +3,20 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Set Password" %}{% endblock %} {% block head_title %}
{% translate "Set Password" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Set Password" %}</h1> <h1>{% translate "Set Password" %}</h1>
<form method="post"
<form method="POST" action="{% url 'account_set_password' %}" class="password_set"> action="{% url 'account_set_password' %}"
{% csrf_token %} class="password_set">
{{ form|crispy }} {% csrf_token %}
<input class="btn btn-primary" type="submit" name="action" value="{% translate 'Set Password' %}"/> {{ form|crispy }}
</form> <input class="btn btn-primary"
{% endblock %} type="submit"
name="action"
value="{% translate 'Set Password' %}" />
</form>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -3,21 +3,26 @@
{% load i18n %} {% load i18n %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block head_title %}{% translate "Signup" %}{% endblock %} {% block head_title %}
{% translate "Signup" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Sign Up" %}</h1> <h1>{% translate "Sign Up" %}</h1>
<p>
<p>{% blocktranslate %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktranslate %}</p> {% blocktranslate %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktranslate %}
</p>
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}"> <form class="signup"
{% csrf_token %} id="signup_form"
{{ form|crispy }} method="post"
{% if redirect_field_value %} action="{% url 'account_signup' %}">
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" /> {% csrf_token %}
{% endif %} {{ form|crispy }}
<button class="btn btn-primary" type="submit">{% translate "Sign Up" %} &raquo;</button> {% if redirect_field_value %}
</form> <input type="hidden"
name="{{ redirect_field_name }}"
{% endblock %} value="{{ redirect_field_value }}" />
{% endif %}
<button class="btn btn-primary" type="submit">{% translate "Sign Up" %} »</button>
</form>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -2,11 +2,11 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Sign Up Closed" %}{% endblock %} {% block head_title %}
{% translate "Sign Up Closed" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Sign Up Closed" %}</h1> <h1>{% translate "Sign Up Closed" %}</h1>
<p>{% translate "We are sorry, but the sign up is currently closed." %}</p>
<p>{% translate "We are sorry, but the sign up is currently closed." %}</p> {% endblock inner %}
{% endblock %}
{%- endraw %} {%- endraw %}

View File

@ -2,12 +2,13 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %} {% block head_title %}
{% translate "Verify Your E-mail Address" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Verify Your E-mail Address" %}</h1> <h1>{% translate "Verify Your E-mail Address" %}</h1>
<p>
<p>{% blocktranslate %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p> {% blocktranslate %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. Please contact us if you do not receive it within a few minutes.{% endblocktranslate %}
</p>
{% endblock %} {% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -2,21 +2,24 @@
{% load i18n %} {% load i18n %}
{% block head_title %}{% translate "Verify Your E-mail Address" %}{% endblock %} {% block head_title %}
{% translate "Verify Your E-mail Address" %}
{% endblock head_title %}
{% block inner %} {% block inner %}
<h1>{% translate "Verify Your E-mail Address" %}</h1> <h1>{% translate "Verify Your E-mail Address" %}</h1>
{% url 'account_email' as email_url %}
{% url 'account_email' as email_url %} <p>
{% blocktranslate %}This part of the site requires us to verify that
<p>{% blocktranslate %}This part of the site requires us to verify that
you are who you claim to be. For this purpose, we require that you you are who you claim to be. For this purpose, we require that you
verify ownership of your e-mail address. {% endblocktranslate %}</p> verify ownership of your e-mail address. {% endblocktranslate %}
</p>
<p>{% blocktranslate %}We have sent an e-mail to you for <p>
{% blocktranslate %}We have sent an e-mail to you for
verification. Please click on the link inside this e-mail. Please verification. Please click on the link inside this e-mail. Please
contact us if you do not receive it within a few minutes.{% endblocktranslate %}</p> contact us if you do not receive it within a few minutes.{% endblocktranslate %}
</p>
<p>{% blocktranslate %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktranslate %}</p> <p>
{% endblock %} {% blocktranslate %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktranslate %}
</p>
{% endblock inner %}
{%- endraw %} {%- endraw %}

View File

@ -1,150 +1,194 @@
{% raw %}{% load static i18n {% endraw %} {% raw %}
{%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}compress {% load static i18n {% endraw %}
{%- endif %}{% raw %}%}{% endraw %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}{% raw %}{% load render_bundle from webpack_loader %}{% endraw %} {%- if cookiecutter.frontend_pipeline == 'Django Compressor' %}compress{%- endif %}{% raw %}%}{% endraw %}
{%- if cookiecutter.frontend_pipeline == 'Webpack' %}{% raw %}
{% load render_bundle from webpack_loader %}
{% endraw %}
{%- endif %}{% raw %}<!DOCTYPE html> {%- endif %}{% raw %}<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
<html lang="{{ LANGUAGE_CODE }}"> <html lang="{{ LANGUAGE_CODE }}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge"> <meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>{% block title %}{% endraw %}{{ cookiecutter.project_name }}{% raw %}{% endblock title %}</title> <title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> {% block title %}
<meta name="description" content="{% endraw %}{{ cookiecutter.description }}{% raw %}"> {% endraw %}{{ cookiecutter.project_name }}{% raw %}
<meta name="author" content="{% endraw %}{{ cookiecutter.author_name }}{% raw %}"> {% endblock title %}
</title>
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}"> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
{% block css %} content="{% endraw %}{{ cookiecutter.description }}{% raw %}" />
{%- endraw %} <meta name="author"
{%- if cookiecutter.frontend_pipeline in ['None', 'Django Compressor'] %} content="{% endraw %}{{ cookiecutter.author_name }}{% raw %}" />
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />
{% block css %}
{%- endraw %}
{%- if cookiecutter.frontend_pipeline in ['None', 'Django Compressor'] %}
{%- raw %} {%- raw %}
<!-- Latest compiled and minified Bootstrap CSS --> <!-- Latest compiled and minified Bootstrap CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css" integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA==" crossorigin="anonymous" referrerpolicy="no-referrer" /> <link rel="stylesheet"
{%- endraw %} href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css"
{%- endif %} integrity="sha512-SbiR/eusphKoMVVXysTKG/7VseWii+Y3FdHrt0EpKgpToZeemhqHeZeLWLhJutz/2ut2Vw1uQEj2MbRF+TVBUA=="
{%- raw %} crossorigin="anonymous"
<!-- Your stuff: Third-party CSS libraries go here --> referrerpolicy="no-referrer" />
{%- endraw %}
<!-- This file stores project-specific CSS --> {%- endif %}
{%- endraw %}{% if cookiecutter.frontend_pipeline == 'None' %}{% raw %} {%- raw %}
<link href="{% static 'css/project.css' %}" rel="stylesheet"> <!-- Your stuff: Third-party CSS libraries go here -->
{%- endraw %}{% elif cookiecutter.frontend_pipeline == 'Django Compressor' %}{% raw %} <!-- This file stores project-specific CSS -->
{% compress css %} {%- endraw %}
<link href="{% static 'css/project.css' %}" rel="stylesheet"> {% if cookiecutter.frontend_pipeline == 'None' %}
{% endcompress %} {% raw %}
{%- endraw %}{% elif cookiecutter.frontend_pipeline == 'Gulp' %}{% raw %} <link href="{% static 'css/project.css' %}" rel="stylesheet" />
<link href="{% static 'css/project.min.css' %}" rel="stylesheet"> {%- endraw %}
{%- endraw %}{% elif cookiecutter.frontend_pipeline == "Webpack" %}{% raw %} {% elif cookiecutter.frontend_pipeline == 'Django Compressor' %}
{% render_bundle 'project' 'css' %} {% raw %}
{%- endraw %}{% endif %}{% raw %} {% compress css %}
{% endblock %} <link href="{% static 'css/project.css' %}" rel="stylesheet" />
<!-- Le javascript {% endcompress %}
{%- endraw %}
{% elif cookiecutter.frontend_pipeline == 'Gulp' %}
{% raw %}
<link href="{% static 'css/project.min.css' %}" rel="stylesheet" />
{%- endraw %}
{% elif cookiecutter.frontend_pipeline == "Webpack" %}
{% raw %}
{% render_bundle 'project' 'css' %}
{%- endraw %}
{% endif %}
{% raw %}
{% endblock css %}
<!-- Le javascript
================================================== --> ================================================== -->
{# Placed at the top of the document so pages load faster with defer #} {# Placed at the top of the document so pages load faster with defer #}
{% block javascript %} {% block javascript %}
{%- endraw %}{% if cookiecutter.frontend_pipeline == 'Gulp' %}{% raw %} {%- endraw %}
<!-- Vendor dependencies bundled as one file --> {% if cookiecutter.frontend_pipeline == 'Gulp' %}
<script defer src="{% static 'js/vendors.min.js' %}"></script> {% raw %}
{%- endraw %}{% elif cookiecutter.frontend_pipeline == "Webpack" %}{% raw %} <!-- Vendor dependencies bundled as one file -->
<!-- Vendor dependencies bundled as one file --> <script defer src="{% static 'js/vendors.min.js' %}"></script>
{% render_bundle 'vendors' 'js' attrs='defer' %} {%- endraw %}
{%- endraw %}{% else %}{% raw %} {% elif cookiecutter.frontend_pipeline == "Webpack" %}
<!-- Bootstrap JS --> {% raw %}
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.min.js" integrity="sha512-1/RvZTcCDEUjY/CypiMz+iqqtaoQfAITmNSJY17Myp4Ms5mdxPS5UV7iOfdZoxcGhzFbOm6sntTKJppjvuhg4g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <!-- Vendor dependencies bundled as one file -->
<!-- Your stuff: Third-party javascript libraries go here --> {% render_bundle 'vendors' 'js' attrs='defer' %}
{%- endraw %}{% endif %}{% raw %} {%- endraw %}
{% else %}
<!-- place project specific Javascript in this file --> {% raw %}
{%- endraw %}{% if cookiecutter.frontend_pipeline == 'None' %}{% raw %} <!-- Bootstrap JS -->
<script defer src="{% static 'js/project.js' %}"></script> <script defer
{%- endraw %}{% elif cookiecutter.frontend_pipeline == 'Django Compressor' %}{% raw %} src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.min.js"
{% compress js %} integrity="sha512-1/RvZTcCDEUjY/CypiMz+iqqtaoQfAITmNSJY17Myp4Ms5mdxPS5UV7iOfdZoxcGhzFbOm6sntTKJppjvuhg4g=="
<script defer src="{% static 'js/project.js' %}"></script> crossorigin="anonymous"
{% endcompress %} referrerpolicy="no-referrer"></script>
{%- endraw %}{% elif cookiecutter.frontend_pipeline == 'Gulp' %}{% raw %} <!-- Your stuff: Third-party javascript libraries go here -->
<script defer src="{% static 'js/project.min.js' %}"></script> {%- endraw %}
{%- endraw %}{% elif cookiecutter.frontend_pipeline == "Webpack" %}{% raw %} {% endif %}
{% render_bundle 'project' 'js' attrs='defer' %} {% raw %}
{%- endraw %}{% endif %}{% raw %} <!-- place project specific Javascript in this file -->
{%- endraw %}
{% endblock javascript %} {% if cookiecutter.frontend_pipeline == 'None' %}
{% raw %}
</head> <script defer src="{% static 'js/project.js' %}"></script>
{%- endraw %}
<body> {% elif cookiecutter.frontend_pipeline == 'Django Compressor' %}
{% raw %}
<div class="mb-1"> {% compress js %}
<nav class="navbar navbar-expand-md navbar-light bg-light"> <script defer src="{% static 'js/project.js' %}"></script>
<div class="container-fluid"> {% endcompress %}
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> {%- endraw %}
<span class="navbar-toggler-icon"></span> {% elif cookiecutter.frontend_pipeline == 'Gulp' %}
</button> {% raw %}
<a class="navbar-brand" href="{% url 'home' %}">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a> <script defer src="{% static 'js/project.min.js' %}"></script>
{%- endraw %}
<div class="collapse navbar-collapse" id="navbarSupportedContent"> {% elif cookiecutter.frontend_pipeline == "Webpack" %}
<ul class="navbar-nav mr-auto"> {% raw %}
<li class="nav-item active"> {% render_bundle 'project' 'js' attrs='defer' %}
<a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a> {%- endraw %}
</li> {% endif %}
{% raw %}
{% endblock javascript %}
</head>
<body>
<div class="mb-1">
<nav class="navbar navbar-expand-md navbar-light bg-light">
<div class="container-fluid">
<button class="navbar-toggler navbar-toggler-right"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand" href="{% url 'home' %}">{% endraw %}{{ cookiecutter.project_name }}{% raw %}</a>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="{% url 'home' %}">Home <span class="visually-hidden">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'about' %}">About</a>
</li>
{% if request.user.is_authenticated %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'about' %}">About</a> <a class="nav-link"
href="{% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{% url 'users:detail' request.user.pk %}{% endraw %}{% else %}{% raw %}{% url 'users:detail' request.user.username %}{% endraw %}{% endif %}{% raw %}">{% translate "My Profile" %}</a>
</li> </li>
{% if request.user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{% url 'users:detail' request.user.pk %}{% endraw %}{% else %}{% raw %}{% url 'users:detail' request.user.username %}{% endraw %}{% endif %}{% raw %}">{% translate "My Profile" %}</a>
</li>
<li class="nav-item">
{# URL provided by django-allauth/account/urls.py #}
<a class="nav-link" href="{% url 'account_logout' %}">{% translate "Sign Out" %}</a>
</li>
{% else %}
{% if ACCOUNT_ALLOW_REGISTRATION %}
<li class="nav-item"> <li class="nav-item">
{# URL provided by django-allauth/account/urls.py #} {# URL provided by django-allauth/account/urls.py #}
<a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a> <a class="nav-link" href="{% url 'account_logout' %}">{% translate "Sign Out" %}</a>
</li> </li>
{% endif %} {% else %}
{% if ACCOUNT_ALLOW_REGISTRATION %}
<li class="nav-item"> <li class="nav-item">
{# URL provided by django-allauth/account/urls.py #} {# URL provided by django-allauth/account/urls.py #}
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% translate "Sign In" %}</a> <a id="sign-up-link" class="nav-link" href="{% url 'account_signup' %}">{% translate "Sign Up" %}</a>
</li> </li>
{% endif %} {% endif %}
</ul> <li class="nav-item">
</div> {# URL provided by django-allauth/account/urls.py #}
<a id="log-in-link" class="nav-link" href="{% url 'account_login' %}">{% translate "Sign In" %}</a>
</li>
{% endif %}
</ul>
</div> </div>
</nav> </div>
</nav>
</div> </div>
<div class="container">
<div class="container"> {% if messages %}
{% for message in messages %}
{% if messages %} <div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}">
{% for message in messages %} {{ message }}
<div class="alert alert-dismissible {% if message.tags %}alert-{{ message.tags }}{% endif %}"> <button type="button"
{{ message }} class="btn-close"
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> data-bs-dismiss="alert"
</div> aria-label="Close"></button>
{% endfor %} </div>
{% endif %} {% endfor %}
{% endif %}
{% block content %} {% block content %}
<p>Use this document as a way to quick start any new project.</p> <p>Use this document as a way to quick start any new project.</p>
{% endblock content %} {% endblock content %}
</div>
</div> <!-- /container --> <!-- /container -->
{% block modal %}
{% block modal %}{% endblock modal %} {% endblock modal %}
{% block inline_javascript %}
{% block inline_javascript %}
{% comment %} {% comment %}
Script tags with only code, no src (defer by default). To run Script tags with only code, no src (defer by default). To run
with a "defer" so that you run inline code: with a "defer" so that you run inline code:
<script> <script>
window.addEventListener('DOMContentLoaded', () => {/* Run whatever you want */}); window.addEventListener('DOMContentLoaded', () => {
/* Run whatever you want */
});
</script> </script>
{% endcomment %} {% endcomment %}
{% endblock inline_javascript %} {% endblock inline_javascript %}
</body> </body>
</html> </html>
{%- endraw %} {%- endraw %}

View File

@ -1 +1,3 @@
{% raw %}{% extends "base.html" %}{% endraw %} {% raw %}{% extends "base.html" %}
{% endraw %}

View File

@ -1 +1,3 @@
{% raw %}{% extends "base.html" %}{% endraw %} {% raw %}{% extends "base.html" %}
{% endraw %}

View File

@ -1,35 +1,45 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% load static %} {% load static %}
{% block title %}User: {% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{{ object.name }}{% endraw %}{% else %}{% raw %}{{ object.username }}{% endraw %}{% endif %}{% raw %}{% endblock %} {% block title %}
User: {% endraw %}
{% if cookiecutter.username_type == "email" %}
{% raw %}{{ object.name }}{% endraw %}
{% else %}
{% raw %}{{ object.username }}{% endraw %}
{% endif %}
{% raw %}
{% endblock title %}
{% block content %} {% block content %}
<div class="container"> <div class="container">
<div class="row">
<div class="row"> <div class="col-sm-12">
<div class="col-sm-12"> <h2>
{% endraw %}
<h2>{% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{{ object.name }}{% endraw %}{% else %}{% raw %}{{ object.username }}{% endraw %}{% endif %}{% raw %}</h2> {% if cookiecutter.username_type == "email" %}
{% if object.name %} {% raw %}{{ object.name }}{% endraw %}
<p>{{ object.name }}</p> {% else %}
{% endif %} {% raw %}{{ object.username }}{% endraw %}
{% endif %}
{% raw %}
</h2>
{% if object.name %}<p>{{ object.name }}</p>{% endif %}
</div> </div>
</div> </div>
{% if object == request.user %}
{% if object == request.user %} <!-- Action buttons -->
<!-- Action buttons --> <div class="row">
<div class="row"> <div class="col-sm-12">
<a class="btn btn-primary" href="{% url 'users:update' %}" role="button">My Info</a>
<div class="col-sm-12"> <a class="btn btn-primary"
<a class="btn btn-primary" href="{% url 'users:update' %}" role="button">My Info</a> href="{% url 'account_email' %}"
<a class="btn btn-primary" href="{% url 'account_email' %}" role="button">E-Mail</a> role="button">E-Mail</a>
<!-- Your Stuff: Custom user template urls --> <!-- Your Stuff: Custom user template urls -->
</div> </div>
</div>
</div> <!-- End Action buttons -->
<!-- End Action buttons --> {% endif %}
{% endif %}
</div> </div>
{% endblock content %} {% endblock content %}
{%- endraw %} {%- endraw %}

View File

@ -1,18 +1,36 @@
{% raw %}{% extends "base.html" %} {% raw %}{% extends "base.html" %}
{% load crispy_forms_tags %} {% load crispy_forms_tags %}
{% block title %}{% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{{ user.name }}{% endraw %}{% else %}{% raw %}{{ user.username }}{% endraw %}{% endif %}{% raw %}{% endblock %} {% block title %}
{% endraw %}
{% if cookiecutter.username_type == "email" %}
{% raw %}{{ user.name }}{% endraw %}
{% else %}
{% raw %}{{ user.username }}{% endraw %}
{% endif %}
{% raw %}
{% endblock title %}
{% block content %} {% block content %}
<h1>{% endraw %}{% if cookiecutter.username_type == "email" %}{% raw %}{{ user.name }}{% endraw %}{% else %}{% raw %}{{ user.username }}{% endraw %}{% endif %}{% raw %}</h1> <h1>
<form class="form-horizontal" method="post" action="{% url 'users:update' %}"> {% endraw %}
{% csrf_token %} {% if cookiecutter.username_type == "email" %}
{{ form|crispy }} {% raw %}{{ user.name }}{% endraw %}
<div class="control-group"> {% else %}
<div class="controls"> {% raw %}{{ user.username }}{% endraw %}
<button type="submit" class="btn btn-primary">Update</button> {% endif %}
</div> {% raw %}
</h1>
<form class="form-horizontal"
method="post"
action="{% url 'users:update' %}">
{% csrf_token %}
{{ form|crispy }}
<div class="control-group">
<div class="controls">
<button type="submit" class="btn btn-primary">Update</button>
</div> </div>
</form> </div>
{% endblock %} </form>
{% endblock content %}
{%- endraw %} {%- endraw %}

View File

@ -1,16 +1,37 @@
from typing import Any from __future__ import annotations
import typing
from allauth.account.adapter import DefaultAccountAdapter from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.conf import settings from django.conf import settings
from django.http import HttpRequest from django.http import HttpRequest
if typing.TYPE_CHECKING:
from allauth.socialaccount.models import SocialLogin
from {{cookiecutter.project_slug}}.users.models import User
class AccountAdapter(DefaultAccountAdapter): class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request: HttpRequest): def is_open_for_signup(self, request: HttpRequest) -> bool:
return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True) return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
class SocialAccountAdapter(DefaultSocialAccountAdapter): class SocialAccountAdapter(DefaultSocialAccountAdapter):
def is_open_for_signup(self, request: HttpRequest, sociallogin: Any): def is_open_for_signup(self, request: HttpRequest, sociallogin: SocialLogin) -> bool:
return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True) return getattr(settings, "ACCOUNT_ALLOW_REGISTRATION", True)
def populate_user(self, request: HttpRequest, sociallogin: SocialLogin, data: dict[str, typing.Any]) -> User:
"""
Populates user information from social provider info.
See: https://django-allauth.readthedocs.io/en/latest/advanced.html?#creating-and-populating-user-instances
"""
user = sociallogin.user
if name := data.get("name"):
user.name = name
elif first_name := data.get("first_name"):
user.name = first_name
if last_name := data.get("last_name"):
user.name += f" {last_name}"
return super().populate_user(request, sociallogin, data)