superusers at creation gets automatically valid registration

This commit is contained in:
Pierre-antoine Comby 2020-09-02 17:22:06 +02:00
parent cde35ea9f9
commit 3e42f4fffb
1 changed files with 3 additions and 0 deletions

View File

@ -13,4 +13,7 @@ def save_user_profile(instance, created, raw, **_kwargs):
if created and instance.is_active: if created and instance.is_active:
from .models import Profile from .models import Profile
Profile.objects.get_or_create(user=instance) Profile.objects.get_or_create(user=instance)
if instance.is_superuser:
instance.profile.email_confirmed = True
instance.profile.registration_valid = True
instance.profile.save() instance.profile.save()