Hi All,
I would like to ask something, I´m trying to render a table using Django-tables2 and that table has a link column that I want to link with another page, I cant figure out how can I link my model, and pass my PK to url.py. Here’s My code:
############
## Models.py: ##
############
class Projetos(models.Model):
#FIELDS
nome_projeto = models.CharField("Projeto", max_length=150, null='true',)
desc_oferta = models.CharField("Descrição da oferta", max_length=500, null='true',) #aumentar
integrador = models.CharField("Integrador", max_length=150, null='true',)
contend_provider = models.CharField("Contend Provider", max_length=150, null='true',)
marca_servico = models.CharField("Marca do Serviço", max_length=150, null='true',)
valor_retry = models.IntegerField("Valor de retry", null='true',)
la = models.IntegerField("Large account", null='true',)
lanc_comercial = models.DateField("Lançamento comercial", null='true')
term_projeto = models.DateField("Término do projeto", null='true')
data_acordo = models.DateField("Data de Acordo", null='true')
data_revisao = models.DateField("Data de Revisão", null='true')
ura_id = models.IntegerField("URA ID", null='true')
ura_desc = models.CharField("Descição URA",max_length=150, null='true')
############
## tables.py ##
############
TEMPLATE = '''
<a href="{% url project_docs %}" >Edit</a>
<a href="{% url project_edit %}" >  upload</a>
'''
class ProjetosMain(tables.Table):
pdb.set_trace()
nome_projeto = tables.Column(verbose_name='Projeto',orderable=False)
integrador = tables.Column(verbose_name='Integrador',orderable=False)
contend_provider = tables.Column(verbose_name='CP',orderable=False)
status = tables.Column(verbose_name='Status',orderable=False)
term_projeto = tables.Column(verbose_name='Vigencia',orderable=False)
Acoes = tables.TemplateColumn(TEMPLATE)
class Meta:
attrs = {'class': 'bordered'}
#########
## url.py ##
#########
urlpatterns = patterns('',
# Main Page portal
(r'^$', portal_main_page),
# Home Page
(r'home/$', portal_main_page),
# Project Page
url(r'projetos/$', projetos_main_page),
url(r'projetos/?P<project_id>\d{1,2,3,4}/edit/', project_edit, name="project_edit"),
url(r'projetos/?P<project_id>\d{1,2,3,4}/docs/', project_docs, name="project_docs"),
# Upload File
(r'^uploadfile/$', uploadfile),
(r'^uploadsuccess/$', uploadsuccess),
)
Best Regards / Muito Obrigado,
--
Roberto Ferreira Junior
11 98009942
Hi Matt,
When I use linkcolum instead of a template tag, my collum cell does not display nothing!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/vm2VIX0jZOAJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.