how do i inherit models fields from another model in django code example
Example 1: django __str__ self multiple
class MyclubUser(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
email = models.EmailField('User Email')
def __str__(self):
return self.first_name + " " + self.last_name
class Subscriber(MyclubUser):
date_joined = models.DateTimeField()
Example 2: creating base models django
class BaseModel(models.Model):
creation_date = models.DateTimeField(..)
validity_start_date = models.DateTimeField(..)
validity_end_date = models.DateTimeField(..)
class Meta:
abstract=True