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

Token model: add missing on_delete parameter to user field (support Django 2.0+) #2

Open
RobWeber3 opened this issue Dec 12, 2019 · 0 comments

Comments

@RobWeber3
Copy link

RobWeber3 commented Dec 12, 2019

Hi Jason, thank you for this nice library, it's exactly what I'm looking for since I have an API that I want to use token authentication for but I cannot use the Django REST API for it, so this is perfect.

My project is running Django 2.2 and when implementing your library, the missing on_delete parameter on the Token model's user field causes an issue because this is a required parameter since Django 2.0+. The error is: TypeError: __init__() missing 1 required positional argument: 'on_delete'.

To fix this, the line can be changed to: user = models.OneToOneField(settings.AUTH_USER_MODEL, related_name="token", on_delete=models.CASCADE).

I added a PR for this: #4

@RobWeber3 RobWeber3 changed the title Support for Django 2.0+ Token model: add missing on_delete parameter to user field (support Django 2.0+) Dec 12, 2019
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

No branches or pull requests

1 participant