如何从 django-simple-history 解析查询集?
How to parse the queryset from django-simple-history?
如何将查询集从 django-simple-history 解析为 html table 列:history_id、history_date 等。我继承了详细视图 class
示例表单 django-simple-history:
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 Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
history = HistoricalRecords()
现在您可以通过以下方式访问历史记录:
all_history = poll.history.all()
更多信息:
如何将查询集从 django-simple-history 解析为 html table 列:history_id、history_date 等。我继承了详细视图 class
示例表单 django-simple-history:
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 Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
history = HistoricalRecords()
现在您可以通过以下方式访问历史记录:
all_history = poll.history.all()
更多信息: