DEV Community

siddharth shukla
siddharth shukla

Posted on

How to Create an admin user

First, create Model

class Contact(models.Model):
name = models.CharField(max_length=100)
email = models.EmailField(max_length=100)
subject = models.CharField(max_length=100)
message = models.TextField()
mobile = models.IntegerField()
created_date = models.DateField(auto_now_add=True)
Import model within the admin

from django.contrib import admin
from .models import Contact

Register your models here.

admin.site.register(Contact)

Read more: https://realprogrammer.in/how-to-create-an-admin-user/

Top comments (0)