Django-tables LinkColumn need help
Ive been using django-tables and I love them, however I need to make
links that would be linking out to different websites depending on the
content of the django-table cells
for example:
10202 in a table would link out to http://somewebpate/10202
http://readthedocs.org/docs/django-tables/en/master/index.html?highlight=linkcolumn
Has the explanation on how to do it:
# models.py
class Person(models.Model):
name = models.CharField(max_length=200)
# urls.py
urlpatterns = patterns('',
url('people/(\d+)/', views.people_detail, name='people_detail')
)
# tables.py
from django_tables.utils import A # alias for Accessor
class PeopleTable(tables.Table):
name = tables.LinkColumn('people_detail', args=[A('pk')])
However there is a part that is missing... the "templates" and the
"views"
i assume that args=[A('pk')] collects the value of a table, but when I
try to implement it i get an error
'type' object is unsubscriptable
I am trying to collect 'pk'
in views under
thing =request.GET['pk']
Thanks a lot
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home