Skip to content

use user.pk instead of user.id #1445

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

Closed
wants to merge 2 commits into from

Conversation

sahama
Copy link
Contributor

@sahama sahama commented Jul 31, 2024

Fixes :

  • use user.pk instead of user.id

Description of the Change

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

Copy link

codecov bot commented Jul 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.28%. Comparing base (102c851) to head (e50c58b).
Report is 44 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1445      +/-   ##
==========================================
- Coverage   97.42%   97.28%   -0.15%     
==========================================
  Files          32       32              
  Lines        2096     2096              
==========================================
- Hits         2042     2039       -3     
- Misses         54       57       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@n2ygk
Copy link
Member

n2ygk commented Jul 31, 2024

Please explain why this is needed. Is there an open issue that this fixes?

@n2ygk n2ygk mentioned this pull request Jul 31, 2024
4 tasks
@sahama
Copy link
Contributor Author

sahama commented Jul 31, 2024

Please explain why this is needed. Is there an open issue that this fixes?

Django allow's to use custom primary key.
for example:

class User(AbstractUser):
    uid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)

And also in django oauth toolkit it is ok to use custom Application and other models.

class Application(AbstractApplication):
    uid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)

so for example if i use uuid as primary key and name primary key as uid or gid, this accure bug in some cases.

@sahama sahama closed this Aug 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants