From 7bf70c933b1646c5e5f01351ae88a269f7335ec1 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 19 May 2021 10:11:13 +0200 Subject: [PATCH] fix: Remove obsolete AccountRequest model --- .../migrations/0005_delete_accountrequest.py | 16 ++++++++++++++++ userausfall/models.py | 12 ------------ userausfall/rest_api/serializers.py | 2 +- userausfall/signals.py | 10 ---------- 4 files changed, 17 insertions(+), 23 deletions(-) create mode 100644 userausfall/migrations/0005_delete_accountrequest.py diff --git a/userausfall/migrations/0005_delete_accountrequest.py b/userausfall/migrations/0005_delete_accountrequest.py new file mode 100644 index 0000000..132ed0e --- /dev/null +++ b/userausfall/migrations/0005_delete_accountrequest.py @@ -0,0 +1,16 @@ +# Generated by Django 2.2.20 on 2021-05-19 08:10 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('userausfall', '0004_user_confidant'), + ] + + operations = [ + migrations.DeleteModel( + name='AccountRequest', + ), + ] diff --git a/userausfall/models.py b/userausfall/models.py index 55efac2..d4f8b11 100644 --- a/userausfall/models.py +++ b/userausfall/models.py @@ -101,15 +101,3 @@ class User(AbstractBaseUser, PermissionsMixin): def email_user(self, subject, message, from_email=None, **kwargs): """Send an email to this user.""" send_mail(subject, message, from_email, [self.email], **kwargs) - - -class AccountRequest(models.Model): - created_time = models.DateTimeField(auto_now_add=True) - - email = models.EmailField() - is_verified = models.BooleanField(default=False) - - confidant_email = models.EmailField(blank=True) - is_trustable = models.BooleanField(default=False) - - username = models.CharField(max_length=100, blank=True) diff --git a/userausfall/rest_api/serializers.py b/userausfall/rest_api/serializers.py index 97ced7b..c4acdbd 100644 --- a/userausfall/rest_api/serializers.py +++ b/userausfall/rest_api/serializers.py @@ -1,6 +1,6 @@ from rest_framework import serializers -from userausfall.models import AccountRequest, User +from userausfall.models import User class UserSerializer(serializers.ModelSerializer): diff --git a/userausfall/signals.py b/userausfall/signals.py index f5a984b..e69de29 100644 --- a/userausfall/signals.py +++ b/userausfall/signals.py @@ -1,10 +0,0 @@ -from django.db.models.signals import post_save -from django.dispatch import receiver - -from userausfall.models import AccountRequest - - -@receiver(post_save, sender=AccountRequest) -def account_request_saved(sender, instance: AccountRequest, **kwargs): - if instance.is_verified and instance.is_trustable and instance.username: - print('Create account and send password mail')