fix: Remove obsolete AccountRequest model
This commit is contained in:
parent
048c8927b8
commit
7bf70c933b
4 changed files with 17 additions and 23 deletions
16
userausfall/migrations/0005_delete_accountrequest.py
Normal file
16
userausfall/migrations/0005_delete_accountrequest.py
Normal file
|
@ -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',
|
||||||
|
),
|
||||||
|
]
|
|
@ -101,15 +101,3 @@ class User(AbstractBaseUser, PermissionsMixin):
|
||||||
def email_user(self, subject, message, from_email=None, **kwargs):
|
def email_user(self, subject, message, from_email=None, **kwargs):
|
||||||
"""Send an email to this user."""
|
"""Send an email to this user."""
|
||||||
send_mail(subject, message, from_email, [self.email], **kwargs)
|
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)
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from userausfall.models import AccountRequest, User
|
from userausfall.models import User
|
||||||
|
|
||||||
|
|
||||||
class UserSerializer(serializers.ModelSerializer):
|
class UserSerializer(serializers.ModelSerializer):
|
||||||
|
|
|
@ -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')
|
|
Reference in a new issue