[Answered ]-Django Inheritance project

1👍

You should be fixing inheritance in the active models from CommonData abstract model. Checkout the corrections made in defining Student, Employee, Customer model classes. After changing, it should be working most likely.

from django.db import models

# Create your models here.
class CommonData(models.Model):
    name = models.CharField(max_length=20)
    location = models.CharField(max_length=20)
    class Meta:
        abstract = True

class Student(CommonData):
    marks = models.IntegerField()
    clg_name = models.CharField(max_length=20)

class Employee(CommonData):
    salary = models.IntegerField()
    company = models.CharField(max_length=50)

class Customer(CommonData):
    sales = models.IntegerField()
    email = models.EmailField(max_length=50)
👤Anvesh

Leave a comment