Answers for "creating base models django"

0

creating base models django

class BaseModel(models.Model):  # base class should subclass 'django.db.models.Model'

    creation_date = models.DateTimeField(..) # define the common field1
    validity_start_date = models.DateTimeField(..) # define the common field2
    validity_end_date = models.DateTimeField(..) # define the common field3

    class Meta:
        abstract=True # Set this model as Abstract
Posted by: Guest on June-11-2020

Python Answers by Framework

Browse Popular Code Answers by Language