Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link a model to a specific record #1367

Open
naquiroz opened this issue Jul 3, 2024 · 0 comments
Open

Link a model to a specific record #1367

naquiroz opened this issue Jul 3, 2024 · 0 comments

Comments

@naquiroz
Copy link

naquiroz commented Jul 3, 2024

Problem Statement

I want to be able to link a model to a historial record of another model, for example:

from django.db import models
from simple_history.models import HistoricalRecords

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')
    history = HistoricalRecords()

class PollReview(models.Model):
    poll_reviewed = HistoricalPoll()
    reviewed_comment = models.CharField(max_length=200)
    reviewed_by = ...

Describe the solution you'd like

I wan't to know if that is currently possible, and if so, how to do it. If not, find a workaround.

Describe alternatives you've considered
I thought of storing a charfield pointing to the id of a record, but that would add an additional step of having to query the record.

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant