Skip to content

New polymorphic parent model for already polymorphic model #484

@mhmousavi

Description

@mhmousavi

Hello and thank you for your great package.
I've faced a little problem with migrating when I set new parent class for my polymorphic subclass. Here is an example:

before:

class Exam(PolymorphicModel):
	# Exam model fields ...

after:

class ParentExam(PolymorphicModel):
	# some new fields ...

class Exam(ParentExam):
	# changes in exam fields

After these changes, I can't migrate cause I have to populate 'parentexam_ptr_id' field for exam model in my migrations and there is no easy way to set or make default ParentExam model for each Exam instance.

I've found several answers but they all recommended to duplicate my database (like this one).

I'm looking for much easier and more sensible ways to solve this problem. Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions