Merge branch 'master' into djangoissuer

# Conflicts:
#	requirements.txt
This commit is contained in:
Bruno Alla 2021-11-10 20:06:38 +00:00
commit 50899cb493
7 changed files with 31 additions and 9 deletions

View File

@ -3,6 +3,18 @@ All enhancements and patches to Cookiecutter Django will be documented in this f
<!-- GENERATOR_PLACEHOLDER --> <!-- GENERATOR_PLACEHOLDER -->
## [2021-11-09]
### Changed
- refactor: remove user API methods parameter ([#3385](https://github.com/cookiecutter/cookiecutter-django/pull/3385))
- Get GitHub repo from environment ([#3387](https://github.com/cookiecutter/cookiecutter-django/pull/3387))
### Updated
- Update celery to 5.2.0 ([#3384](https://github.com/cookiecutter/cookiecutter-django/pull/3384))
- Update isort to 5.10.1 ([#3386](https://github.com/cookiecutter/cookiecutter-django/pull/3386))
## [2021-11-08]
### Changed
- Update docker and non-docker configs to Debian 11 (bullseye) ([#3372](https://github.com/cookiecutter/cookiecutter-django/pull/3372))
## [2021-11-07] ## [2021-11-07]
### Updated ### Updated
- Update django-extensions to 3.1.5 ([#3383](https://github.com/cookiecutter/cookiecutter-django/pull/3383)) - Update django-extensions to 3.1.5 ([#3383](https://github.com/cookiecutter/cookiecutter-django/pull/3383))

View File

@ -5,7 +5,7 @@ binaryornot==0.4.4
# Code quality # Code quality
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
black==21.9b0 black==21.9b0
isort==5.10.0 isort==5.10.1
flake8==4.0.1 flake8==4.0.1
flake8-isort==4.1.1 flake8-isort==4.1.1
pre-commit==2.15.0 pre-commit==2.15.0
@ -21,5 +21,5 @@ pyyaml==6.0
# Scripting # Scripting
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
PyGithub==1.55 PyGithub==1.55
jinja2==3.0.2 jinja2==3.0.3
requests==2.25.1 requests==2.25.1

View File

@ -8,6 +8,7 @@ from jinja2 import Template
CURRENT_FILE = Path(__file__) CURRENT_FILE = Path(__file__)
ROOT = CURRENT_FILE.parents[1] ROOT = CURRENT_FILE.parents[1]
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", None) GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", None)
GITHUB_REPO = os.getenv("GITHUB_REPOSITORY", None)
# Generate changelog for PRs merged yesterday # Generate changelog for PRs merged yesterday
MERGED_DATE = dt.date.today() - dt.timedelta(days=1) MERGED_DATE = dt.date.today() - dt.timedelta(days=1)
@ -40,9 +41,7 @@ def main() -> None:
def iter_pulls(): def iter_pulls():
"""Fetch merged pull requests at the date we're interested in.""" """Fetch merged pull requests at the date we're interested in."""
repo = Github(login_or_token=GITHUB_TOKEN).get_repo( repo = Github(login_or_token=GITHUB_TOKEN).get_repo(GITHUB_REPO)
"cookiecutter/cookiecutter-django"
)
recent_pulls = repo.get_pulls( recent_pulls = repo.get_pulls(
state="closed", sort="updated", direction="desc" state="closed", sort="updated", direction="desc"
).get_page(0) ).get_page(0)
@ -78,4 +77,8 @@ def generate_md(grouped_pulls):
if __name__ == "__main__": if __name__ == "__main__":
if GITHUB_REPO is None:
raise RuntimeError(
"No github repo, please set the environment variable GITHUB_REPOSITORY"
)
main() main()

View File

@ -1,4 +1,5 @@
import json import json
import os
from pathlib import Path from pathlib import Path
from github import Github from github import Github
@ -8,6 +9,8 @@ from jinja2 import Template
CURRENT_FILE = Path(__file__) CURRENT_FILE = Path(__file__)
ROOT = CURRENT_FILE.parents[1] ROOT = CURRENT_FILE.parents[1]
BOT_LOGINS = ["pyup-bot"] BOT_LOGINS = ["pyup-bot"]
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", None)
GITHUB_REPO = os.getenv("GITHUB_REPOSITORY", None)
def main() -> None: def main() -> None:
@ -40,7 +43,7 @@ def iter_recent_authors():
Use Github API to fetch recent authors rather than Use Github API to fetch recent authors rather than
git CLI to work with Github usernames. git CLI to work with Github usernames.
""" """
repo = Github(per_page=5).get_repo("cookiecutter/cookiecutter-django") repo = Github(login_or_token=GITHUB_TOKEN, per_page=5).get_repo(GITHUB_REPO)
recent_pulls = repo.get_pulls( recent_pulls = repo.get_pulls(
state="closed", sort="updated", direction="desc" state="closed", sort="updated", direction="desc"
).get_page(0) ).get_page(0)
@ -102,4 +105,8 @@ def write_md_file(contributors):
if __name__ == "__main__": if __name__ == "__main__":
if GITHUB_REPO is None:
raise RuntimeError(
"No github repo, please set the environment variable GITHUB_REPOSITORY"
)
main() main()

View File

@ -16,7 +16,7 @@ repos:
- id: black - id: black
- repo: https://github.com/timothycrosley/isort - repo: https://github.com/timothycrosley/isort
rev: 5.10.0 rev: 5.10.1
hooks: hooks:
- id: isort - id: isort

View File

@ -17,7 +17,7 @@ redis==3.5.3 # https://github.com/andymccurdy/redis-py
hiredis==2.0.0 # https://github.com/redis/hiredis-py hiredis==2.0.0 # https://github.com/redis/hiredis-py
{%- endif %} {%- endif %}
{%- if cookiecutter.use_celery == "y" %} {%- if cookiecutter.use_celery == "y" %}
celery==5.1.2 # pyup: < 6.0 # https://github.com/celery/celery celery==5.2.0 # pyup: < 6.0 # https://github.com/celery/celery
django-celery-beat==2.2.1 # https://github.com/celery/django-celery-beat django-celery-beat==2.2.1 # https://github.com/celery/django-celery-beat
{%- if cookiecutter.use_docker == 'y' %} {%- if cookiecutter.use_docker == 'y' %}
flower==1.0.0 # https://github.com/mher/flower flower==1.0.0 # https://github.com/mher/flower

View File

@ -19,7 +19,7 @@ class UserViewSet(RetrieveModelMixin, ListModelMixin, UpdateModelMixin, GenericV
assert isinstance(self.request.user.id, int) assert isinstance(self.request.user.id, int)
return self.queryset.filter(id=self.request.user.id) return self.queryset.filter(id=self.request.user.id)
@action(detail=False, methods=["GET"]) @action(detail=False)
def me(self, request): def me(self, request):
serializer = UserSerializer(request.user, context={"request": request}) serializer = UserSerializer(request.user, context={"request": request})
return Response(status=status.HTTP_200_OK, data=serializer.data) return Response(status=status.HTTP_200_OK, data=serializer.data)