Skip to content

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

Description

@RobWeber3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions