0
votes

models.py

from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class Student(AbstractUser):
    roll_number = models.CharField(max_length=30,unique=True)
    student_name = models.CharField(max_length=200,default='student')
    branch = models.CharField(max_length=20,default='cse')
    sem = models.IntegerField(default=1)
    pic = models.ImageField(null=True,blank=True)
    due_fine = models.IntegerField(default=0)
    USERNAME_FIELD='roll_number'
    REQUIRED_FIELDS=['username','email']
    def __str__(self):
            return self.student_name

I created my own user model here. And when I login to the admin in browser i get the following error: OperationalError at /admin/login/ (1054, "Unknown column 'library_student.id' in 'field list'") Please help, i am unable to figure out this error.

1
Did you run manage.py makemigrations and manage.py migrate?LostMyGlasses

1 Answers

0
votes

Turns out there was some problem with the server..I restarted the server and everything is running well.