[Answer]-How to create a ModelCopy in correct way (django)

1👍

Create an abstract model that’s base for both Resume and ResumeCopy.

class BaseResume(models.Model):
    class Meta:
        abstract = True

    owner = models.ForeignKey(Member)
    realname = models.CharField(max_length=30)
    sex = models.IntegerField(blank=False, choices=SEX_CHOICES, default=1)
    education = models.IntegerField(blank=False, choices=EDUCATION_CHOICES)

    expierence = models.IntegerField(blank=False, choices=EXPERIENCE_CHOICES)
    expect_post = models.IntegerField(blank=False, choices=POST_CHOICES)
    expect_salary = models.IntegerField(blank=False, choices=SALARY_CHOICES)
    city = models.ForeignKey(City)
    location = models.ForeignKey(Location, null=True)

class Resume(BaseResume):
    pass

class ResumeCopy(BaseResume):
    pass

Leave a comment