There is a site on Django, and a custom User model inherited from AbstractUser, but I need to make two types of users a photographer and a regular user. The user (there is a username, email, name + last name) except for how to select and add a photo from the photographer from the page to the favorites there is nothing, but the photographer has a city where he lives, contact details, photo collections. How to register when creating two different users on the site and how to store it in the database. And how it will be displayed in the admin panel.

from django.db import models from django.contrib.auth.models import AbstractUser class CustomUser(AbstractUser): name = models.CharField(blank=True, max_length=255) secondname = models.CharField(blank=True, max_length=255) def __str__(self): return self.email class Photographer(models.Model): profile = models.ForeignKey(CustomUser,on_delete=models.CASCADE) city= models.CharField(blank=True, max_length=255) phonenumber = models.CharField(blank=True, max_length=255) def __str__(self): return self.email class Meta: db_table = 'photographer' class User(models.Model): profile = models.ForeignKey(CustomUser,on_delete=models.CASCADE) def __str__(self): return self.email class Meta: db_table = 'user' 
  • one
    Why don't you just implement groups with different rights and capabilities? - AlTheOne

0