Skip to content

Dynamically created fields aren't tracked #1517

@dwasyl

Description

@dwasyl

I have a few models that inherit from abstract models in another package (django-organizations) that dynamically define some ForeignKey fields based on the app name, this works great, except for when django-simple-history creates the Historical model, the "dynamic" fields are never created.

For example in https://github.com/bennylope/django-organizations/blob/ed4817d0f9794d910f2c791bf31b41d6fc1a3205/src/organizations/base.py#L105 the base model creates a users ForeignKey field if it doesn't already exist in the model.

This helps when inheriting the base models into different applications and avoids hard coding additional fields in each, but it seems to cause django-simple-history to loose track of the new fields.

Is there any way to get historical tracking of the dynamic model fields?

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