Merge branch 'master' into fix_django_31

# Conflicts:
#	{{cookiecutter.project_slug}}/requirements/base.txt
This commit is contained in:
Bruno Alla 2021-02-23 19:10:52 +00:00
commit 4e96b64261
18 changed files with 60 additions and 37 deletions

View File

@ -1072,5 +1072,10 @@
"name": "PJ Hoberman", "name": "PJ Hoberman",
"github_login": "pjhoberman", "github_login": "pjhoberman",
"twitter_username": "" "twitter_username": ""
},
{
"name": "lcd1232",
"github_login": "lcd1232",
"twitter_username": ""
} }
] ]

View File

@ -28,7 +28,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Commit changes - name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4.8.0 uses: stefanzweifel/git-auto-commit-action@v4.9.0
with: with:
commit_message: Update Changelog commit_message: Update Changelog
file_pattern: CHANGELOG.md file_pattern: CHANGELOG.md

View File

@ -24,7 +24,7 @@ jobs:
run: python scripts/update_contributors.py run: python scripts/update_contributors.py
- name: Commit changes - name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4.8.0 uses: stefanzweifel/git-auto-commit-action@v4.9.0
with: with:
commit_message: Update Contributors commit_message: Update Contributors
file_pattern: CONTRIBUTORS.md .github/contributors.json file_pattern: CONTRIBUTORS.md .github/contributors.json

View File

@ -3,6 +3,22 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER --> <!-- GENERATOR_PLACEHOLDER -->
## [2021-02-22]
### Changed
- refactor: remove default cache settings in test.py ([#3064](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3064))
- Update django to 3.0.13 ([#3060](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3060))
### Fixed
- Fix missing Django Debug toolbar with node container ([#2865](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/2865))
- Remove Email from User API ([#3055](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3055))
### Updated
- Bump stefanzweifel/git-auto-commit-action from v4.8.0 to v4.9.0 ([#3065](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3065))
- Update django-crispy-forms to 1.11.1 ([#3063](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3063))
- Update uvicorn to 0.13.4 ([#3062](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3062))
- Update mypy to 0.812 ([#3061](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3061))
- Update sentry-sdk to 0.20.3 ([#3059](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3059))
- Update tox to 3.22.0 ([#3057](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3057))
- Update sphinx to 3.5.1 ([#3056](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3056))
## [2021-02-16] ## [2021-02-16]
### Updated ### Updated
- Update sentry-sdk to 0.20.2 ([#3054](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3054)) - Update sentry-sdk to 0.20.2 ([#3054](https://api.github.com/repos/pydanny/cookiecutter-django/pulls/3054))

View File

@ -978,6 +978,13 @@ Listed in alphabetical order.
</td> </td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>lcd1232</td>
<td>
<a href="https://github.com/lcd1232">lcd1232</a>
</td>
<td></td>
</tr>
<tr> <tr>
<td>Leo won</td> <td>Leo won</td>
<td> <td>

View File

@ -11,7 +11,7 @@ flake8-isort==4.0.0
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
tox==3.21.4 tox==3.22.0
pytest==5.4.3 # pyup: <6 # https://github.com/hackebrot/pytest-cookies/issues/51 pytest==5.4.3 # pyup: <6 # https://github.com/hackebrot/pytest-cookies/issues/51
pytest-cookies==0.5.1 pytest-cookies==0.5.1
pytest-instafail==0.4.2 pytest-instafail==0.4.2

View File

@ -10,7 +10,7 @@ except ImportError:
# Our version ALWAYS matches the version of Django we support # Our version ALWAYS matches the version of Django we support
# If Django has a new release, we branch, tag, then update this setting after the tag. # If Django has a new release, we branch, tag, then update this setting after the tag.
version = "3.0.12" version = "3.0.13"
if sys.argv[-1] == "tag": if sys.argv[-1] == "tag":
os.system(f'git tag -a {version} -m "version {version}"') os.system(f'git tag -a {version} -m "version {version}"')

View File

@ -234,7 +234,7 @@ def test_gitlab_invokes_flake8_and_pytest(
("y", "docker-compose -f local.yml exec -T django pytest"), ("y", "docker-compose -f local.yml exec -T django pytest"),
], ],
) )
def test_github_invokes_flake8_and_pytest( def test_github_invokes_linter_and_pytest(
cookies, context, use_docker, expected_test_script cookies, context, use_docker, expected_test_script
): ):
context.update({"ci_tool": "Github", "use_docker": use_docker}) context.update({"ci_tool": "Github", "use_docker": use_docker})
@ -248,11 +248,11 @@ def test_github_invokes_flake8_and_pytest(
with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml: with open(f"{result.project}/.github/workflows/ci.yml", "r") as github_yml:
try: try:
github_config = yaml.safe_load(github_yml) github_config = yaml.safe_load(github_yml)
flake8_present = False linter_present = False
for action_step in github_config["jobs"]["flake8"]["steps"]: for action_step in github_config["jobs"]["linter"]["steps"]:
if action_step.get("run") == "flake8": if action_step.get("uses", "NA").startswith("pre-commit"):
flake8_present = True linter_present = True
assert flake8_present assert linter_present
expected_test_script_present = False expected_test_script_present = False
for action_step in github_config["jobs"]["pytest"]["steps"]: for action_step in github_config["jobs"]["pytest"]["steps"]:

View File

@ -16,7 +16,7 @@ on:
jobs: jobs:
flake8: linter:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -28,13 +28,11 @@ jobs:
with: with:
python-version: 3.8 python-version: 3.8
- name: Install flake8 # Run all pre-commit hooks on all the files.
run: | # Getting only staged files can be tricky in case a new PR is opened
python -m pip install --upgrade pip # since the action is run on a branch in detached head state
pip install flake8 - name: Install and Run Pre-commit
uses: pre-commit/action@v2.0.0
- name: Lint with flake8
run: flake8
# With no caching at all the entire ci process takes 4m 30s to complete! # With no caching at all the entire ci process takes 4m 30s to complete!
pytest: pytest:

View File

@ -69,6 +69,14 @@ if env("USE_DOCKER") == "yes":
hostname, _, ips = socket.gethostbyname_ex(socket.gethostname()) hostname, _, ips = socket.gethostbyname_ex(socket.gethostname())
INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips] INTERNAL_IPS += [".".join(ip.split(".")[:-1] + ["1"]) for ip in ips]
{%- if cookiecutter.js_task_runner == 'Gulp' %}
try:
_, _, ips = socket.gethostbyname_ex("node")
INTERNAL_IPS.extend(ips)
except socket.gaierror:
# The node container isn't started (yet?)
pass
{%- endif %}
{%- endif %} {%- endif %}
# django-extensions # django-extensions

View File

@ -15,16 +15,6 @@ SECRET_KEY = env(
# https://docs.djangoproject.com/en/dev/ref/settings/#test-runner # https://docs.djangoproject.com/en/dev/ref/settings/#test-runner
TEST_RUNNER = "django.test.runner.DiscoverRunner" TEST_RUNNER = "django.test.runner.DiscoverRunner"
# CACHES
# ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#caches
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "",
}
}
# PASSWORDS # PASSWORDS
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers # https://docs.djangoproject.com/en/dev/ref/settings/#password-hashers

View File

@ -24,7 +24,7 @@ flower==0.9.7 # https://github.com/mher/flower
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}
{%- if cookiecutter.use_async == 'y' %} {%- if cookiecutter.use_async == 'y' %}
uvicorn[standard]==0.13.3 # https://github.com/encode/uvicorn uvicorn[standard]==0.13.4 # https://github.com/encode/uvicorn
{%- endif %} {%- endif %}
# Django # Django
@ -33,7 +33,7 @@ django==3.1.7 # pyup: < 3.2 # https://www.djangoproject.com/
django-environ==0.4.5 # https://github.com/joke2k/django-environ django-environ==0.4.5 # https://github.com/joke2k/django-environ
django-model-utils==4.1.1 # https://github.com/jazzband/django-model-utils django-model-utils==4.1.1 # https://github.com/jazzband/django-model-utils
django-allauth==0.44.0 # https://github.com/pennersr/django-allauth django-allauth==0.44.0 # https://github.com/pennersr/django-allauth
django-crispy-forms==1.11.0 # https://github.com/django-crispy-forms/django-crispy-forms django-crispy-forms==1.11.1 # https://github.com/django-crispy-forms/django-crispy-forms
{%- if cookiecutter.use_compressor == "y" %} {%- if cookiecutter.use_compressor == "y" %}
django-compressor==2.4 # https://github.com/django-compressor/django-compressor django-compressor==2.4 # https://github.com/django-compressor/django-compressor
{%- endif %} {%- endif %}

View File

@ -13,14 +13,14 @@ watchgod==0.6 # https://github.com/samuelcolvin/watchgod
# Testing # Testing
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
mypy==0.800 # https://github.com/python/mypy mypy==0.812 # https://github.com/python/mypy
django-stubs==1.7.0 # https://github.com/typeddjango/django-stubs django-stubs==1.7.0 # https://github.com/typeddjango/django-stubs
pytest==6.2.2 # https://github.com/pytest-dev/pytest pytest==6.2.2 # https://github.com/pytest-dev/pytest
pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar pytest-sugar==0.9.4 # https://github.com/Frozenball/pytest-sugar
# Documentation # Documentation
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
sphinx==3.5.0 # https://github.com/sphinx-doc/sphinx sphinx==3.5.1 # https://github.com/sphinx-doc/sphinx
sphinx-autobuild==2020.9.1 # https://github.com/GaretJax/sphinx-autobuild sphinx-autobuild==2020.9.1 # https://github.com/GaretJax/sphinx-autobuild
# Code quality # Code quality

View File

@ -8,7 +8,7 @@ psycopg2==2.8.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==0.20.2 # https://github.com/getsentry/sentry-python sentry-sdk==0.20.3 # 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==1.1.0 # https://github.com/redis/hiredis-py hiredis==1.1.0 # https://github.com/redis/hiredis-py

View File

@ -5,5 +5,5 @@
{% block content %} {% block content %}
<h1>Forbidden (403)</h1> <h1>Forbidden (403)</h1>
<p>CSRF verification failed. Request aborted.</p> <p>{% if exception %}{{ exception }}{% else %}You're not allowed to access this page.{% endif %}</p>
{% endblock content %}{% endraw %} {% endblock content %}{% endraw %}

View File

@ -5,5 +5,5 @@
{% block content %} {% block content %}
<h1>Page not found</h1> <h1>Page not found</h1>
<p>This is not the page you were looking for.</p> <p>{% if exception %}{{ exception }}{% else %}This is not the page you were looking for.{% endif %}</p>
{% endblock content %}{% endraw %} {% endblock content %}{% endraw %}

View File

@ -7,7 +7,7 @@ User = get_user_model()
class UserSerializer(serializers.ModelSerializer): class UserSerializer(serializers.ModelSerializer):
class Meta: class Meta:
model = User model = User
fields = ["username", "email", "name", "url"] fields = ["username", "name", "url"]
extra_kwargs = { extra_kwargs = {
"url": {"view_name": "api:user-detail", "lookup_field": "username"} "url": {"view_name": "api:user-detail", "lookup_field": "username"}

View File

@ -28,7 +28,6 @@ class TestUserViewSet:
assert response.data == { assert response.data == {
"username": user.username, "username": user.username,
"email": user.email,
"name": user.name, "name": user.name,
"url": f"http://testserver/api/users/{user.username}/", "url": f"http://testserver/api/users/{user.username}/",
} }