Abstract Model Inherit From Another Model Django

[Solved] Abstract Model Inherit From Another Model Django | Python Frameworks Django - Code Explorer | www.yomemimo.com
Question : Abstract Model inherit from another model django

Answered by : alive-alligator-xeeh2ehlbs4d

from django.db import models
class BaseModel(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: abstract = True
class Organisation(BaseModel): name = models.CharField("name of the organisation", max_length=200)
class Profile(BaseModel): user = models.ForeignKey(User, on_delete=models.CASCADE) bio = models.CharField("bio of the user", max_length=500)

Source : | Last Update : Tue, 02 Aug 22

Answers related to Abstract Model inherit from another model django

Code Explorer Popular Question For Python Frameworks Django