我的模板有问题。我尝试呈现以下模板
{% if liste_column %}
<table>
<tr><th>Owner</th>
<th>RegimeID</th>
<th>ClosingeventID</th>
<th>Category</th>
<th>Transaction or Closing</th>
<th>**** Accounting Field</th>
<th>Data Source</th>
</tr>
{% for item in liste_column %}
<tr><td>{{item.owner}}</td>
<td>{{item.regimeid}}</td>
<td>{{item.closingeventid}}</td>
<td>{{item.category}}</td>
<td>{{item.transactionorclosing}}</td>
<td>{{item.****accountingfield}}</td>
<td>{{item.datasource}}</td>
</tr>
{% endfor %}
</table>
{% else %}
<p>No Data are available.</p>
{% endif %}
并获取错误:
Column closingevent.id doesn't exist LINE 1: SELECT "closingevent"."id", "closingevent"."owner", "closing...
我的表没有名为“closingevent”、“id”的列,我甚至没有尝试获取该列。其他模板也有
你能帮我吗?我想可能是因为我的模型没有主键,只有外键
class Closingevent(models.Model):
owner = models.CharField(max_length=800, blank=True, null=True)
regimeid = models.ForeignKey('Regime', models.DO_NOTHING,
db_column='regimeid')
closingeventid = models.FloatField()
category = models.CharField(max_length=800, blank=True, null=True)
closingevent = models.CharField(max_length=800, blank=True, null=True)
transactionorclosing = models.CharField(max_length=1, blank=True,
null=True)
****accountingfield = models.CharField(max_length=1, blank=True,
null=True)
datasource = models.CharField(max_length=800, blank=True, null=True)
debitacoountnumber = models.CharField(max_length=800, blank=True,
null=True)
debitsubitem = models.CharField(max_length=1, blank=True, null=True)
debitaccountname = models.ForeignKey('Lineitemaccounting',
models.DO_NOTHING,db_column='debitaccountname',
blank=True,null=True,related_name='daccountname2')
debitbalancesheet = models.CharField(max_length=1, blank=True, null=True)
debitprofitandlose = models.CharField(max_length=1, blank=True,
null=True)
debitreconciliation = models.CharField(max_length=1, blank=True,
null=True)
creditaccountnumber = models.CharField(max_length=1, blank=True,
null=True)
creditsubitem = models.CharField(max_length=1, blank=True, null=True)
creditaccountname = models.ForeignKey('Lineitemaccounting',
models.DO_NOTHING, db_column='creditaccountname', blank=True,
null=True,related_name='caccountname2')
creditbalancesheet = models.CharField(max_length=1, blank=True,
null=True)
creditprofitandloss = models.CharField(max_length=1, blank=True,
null=True)
creditreconciliation = models.CharField(max_length=1, blank=True,
null=True)
class Meta:
managed = False
db_table = 'closingevent'
unique_together = (('regimeid', 'closingeventid'),)
目前没有回答
相关问题 更多 >
编程相关推荐