我的verbose_name
外键字段不会打印在我的表单中。 (我通过modelformset_factory
模型
class MOrders(models.Model):
amount = models.IntegerField('Bestellmenge', null=True, blank=True)
order_date = models.DateField('Bestelldatum')
id = models.AutoField(primary_key=True)
m_product_types = models.ForeignKey(MProductTypes)
class Meta:
db_table = u'm_orders'
verbose_name = 'Bestellung'
verbose_name_plural = 'Bestellungen'
unique_together = (('id','order_date','m_product_types'))
def __unicode__(self):
return "%s" % (self.order_date)
设置verbose_name
的 m_product_types
。乙
class MProductTypes(models.Model):
id = models.AutoField(primary_key=True)
stock = models.IntegerField('Bestand',null=True, blank=True)
m_products = models.ForeignKey(MProducts, verbose_name='Produkt')
m_sizes = models.ForeignKey(MSizes, verbose_name='Groesse')
m_colors = models.ForeignKey(MColors, verbose_name='Farbe')
class Meta:
verbose_name = u'Produktart'
verbose_name_plural = 'Produktarten'
db_table = u'm_product_types'
我做错了吗?我正在使用trunk中最新的Django版本。
答案 0 :(得分:12)
m_product_types = models.ForeignKey(MProductTypes,
verbose_name = u'Produktart',
)