diff --git a/magic_link/migrations/0005_alter_magiclink_token.py b/magic_link/migrations/0005_alter_magiclink_token.py new file mode 100644 index 0000000..d06a443 --- /dev/null +++ b/magic_link/migrations/0005_alter_magiclink_token.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1.4 on 2023-12-02 14:04 + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ("magic_link", "0004_remove_magiclinkuse_link_is_valid"), + ] + + operations = [ + migrations.AlterField( + model_name="magiclink", + name="token", + field=models.CharField( + default=uuid.uuid4, + editable=False, + help_text="Unique login token", + max_length=36, + unique=True, + ), + ), + ] diff --git a/magic_link/models.py b/magic_link/models.py index 5dee7d5..892cb90 100644 --- a/magic_link/models.py +++ b/magic_link/models.py @@ -44,8 +44,8 @@ class MagicLink(models.Model): user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="magic_links" ) - token = models.UUIDField( - default=uuid.uuid4, editable=False, unique=True, help_text="Unique login token" + token = models.CharField( + default=uuid.uuid4, editable=False, unique=True, help_text="Unique login token", max_length=36 ) redirect_to = models.CharField( help_text="URL to which user will be redirected after logging in. ('/')",