BlueBear icon

userprofile_issue

BlueBear | PRO | 03/03/17 09:56:49 AM UTC | 0 ⭐ | 523 👁️ | Never ⏰ | []
Python |

1.15 KB

|

None

|

0 👍

/

0 👎

class UserManager(BaseUserManager):
    use_in_migrations = True
    def _create_user(self, email, password, **extra_fields):
 
    if not email:
        raise ValueError('The given email must be set')
    email = self.normalize_email(email) 
    user = self.model(email=email, **extra_fields)
    user.set_password(password)
    user.save(using=self._db)
    return user
    def create_user(self, email, password=None, **extra_fields):
        extra_fields.setdefault('is_superuser', False)
        return self._create_user(email, password, **extra_fields)
    def create_superuser(self, email, password, **extra_fields):
    extra_fields.setdefault('is_superuser', True)
    if extra_fields.get('is_superuser') is not True:
        raise ValueError('Superuser must have is_superuser=True.')
    return self._create_user(email, password, **extra_fields)
class UserProfile(models.Model):
    avatar = models.URLField()
    user = models.ForeignKey(User, unique=True)
    objects = UserManager()
    @receiver(post_save, sender=User)
    def create_user_profile(sender, **kwargs):
        #When creating a new user, make a profile for him or her.
        u = kwargs["instance"]
        if not UserProfile.objects.filter
        UserProfile(user=u).save()

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Suikzau icon
    03/31/26 10:09:42 PM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
     Remove the @ 
  • Zyubi icon
    04/05/26 02:29:26 AM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400