-1

I want to create the new UserModel that is a Custom from User Model django, then add extended attribute and methods like Proxy model and One-To-One Link Model together. I want to use Authentication and permission UserModel django to my defined UserModel for my two type Users that are my defined Admin and staff User. How to use just username and password for Authentication for My UserModels and other custom fields.

How to create it and fill with the ModelForm?

MBT
  • 21,733
  • 19
  • 84
  • 102
  • 2
    Possible duplicate of [Extending the User model with custom fields in Django](https://stackoverflow.com/questions/44109/extending-the-user-model-with-custom-fields-in-django) – Nils Werner Nov 04 '17 at 13:18

1 Answers1

0

You might want to extend AbstractUser like this :

from django.contrib.auth.models import AbstractUser

class MyUser(AbstractUser):

    slug = models.UUIDField(default=uuid4, blank=True, editable=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    picture = models.ImageField('Profile picture',
                                upload_to='profile_pics/%Y-%m-%d/',
                                null=True,
                                blank=True)

And so on

mbieren
  • 1,034
  • 8
  • 31