django-simple-history icon indicating copy to clipboard operation
django-simple-history copied to clipboard

Link a model to a specific record

Open naquiroz opened this issue 7 months ago • 0 comments

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.

naquiroz avatar Jul 03 '24 21:07 naquiroz