Answer the question
In order to leave comments, you need to log in
How to display a field in a Djano template?
There is a model:
class ProjectCompany(models.Model):
ROLES = (
('З', 'Заказчик'),
('Т', 'Технический Заказчик'),
('П', 'Проектировщик'),
('Г', 'Генподрядчик'),
('C', 'Субподрядчик'),
)
project = models.ForeignKey(Project, null=True)
company = models.ForeignKey(Company)
company_role = models.CharField(max_length=2, choices=ROLES, blank=True)
date_log = models.DateTimeField(verbose_name=u'Дата регистрации', auto_now_add=True)
Answer the question
In order to leave comments, you need to log in
For the But template
, this is a method, so you need to add parentheses in the view.instance.get_company_role_display()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question