Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actually use USER_ID_FIELD in some places it wasnt used #789

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Change Log
This document records all notable changes to djoser.
This project adheres to `Semantic Versioning <http://semver.org/>`_.

---------------------
`2.2.2`_ (2023-11-09)
---------------------

* fix regression: rollback path changes as it resulted in regressions for some https://github.com/sunscrapers/djoser/issues/778
* add Django 5 to test suite pipeline - consider it being supported https://github.com/sunscrapers/djoser/issues/772
* fix in docs https://github.com/sunscrapers/djoser/commit/641b824353627a73ba901f7e81b86246384d1327

---------------------
`2.2.1`_ (2023-11-05)
---------------------
Expand Down Expand Up @@ -424,3 +432,4 @@ few bugfixes / documentation updates. List of changes:
.. _2.1.0: https://github.com/sunscrapers/djoser/compare/2.0.5...2.1.0
.. _2.2.0: https://github.com/sunscrapers/djoser/compare/2.1.0...2.2.0
.. _2.2.1: https://github.com/sunscrapers/djoser/compare/2.2.0...2.2.1
.. _2.2.2: https://github.com/sunscrapers/djoser/compare/2.2.1...2.2.2
6 changes: 3 additions & 3 deletions djoser/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_context_data(self):
context = super().get_context_data()

user = context.get("user")
context["uid"] = utils.encode_uid(user.pk)
context["uid"] = utils.encode_uid(getattr(user, settings.USER_ID_FIELD))
context["token"] = default_token_generator.make_token(user)
context["url"] = settings.ACTIVATION_URL.format(**context)
return context
Expand All @@ -31,7 +31,7 @@ def get_context_data(self):
context = super().get_context_data()

user = context.get("user")
context["uid"] = utils.encode_uid(user.pk)
context["uid"] = utils.encode_uid(getattr(user, settings.USER_ID_FIELD))
context["token"] = default_token_generator.make_token(user)
context["url"] = settings.PASSWORD_RESET_CONFIRM_URL.format(**context)
return context
Expand All @@ -52,7 +52,7 @@ def get_context_data(self):
context = super().get_context_data()

user = context.get("user")
context["uid"] = utils.encode_uid(user.pk)
context["uid"] = utils.encode_uid(getattr(user, settings.USER_ID_FIELD))
context["token"] = default_token_generator.make_token(user)
context["url"] = settings.USERNAME_RESET_CONFIRM_URL.format(**context)
return context
2 changes: 1 addition & 1 deletion djoser/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def validate(self, attrs):
# doesn't work with modelserializer
try:
uid = utils.decode_uid(self.initial_data.get("uid", ""))
self.user = User.objects.get(pk=uid)
self.user = User.objects.get(**{settings.USER_ID_FIELD: uid})
except (User.DoesNotExist, ValueError, TypeError, OverflowError):
key_error = "invalid_uid"
raise ValidationError(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "djoser"
version = "2.2.1"
version = "2.2.2"
description = "REST implementation of Django authentication system."
authors = [
"Sunscrapers <[email protected]>",
Expand Down