I'm trying to access the Theme name and put it in my template. It's been working fine until I set the Theme.name as primary key. Did the primary_key=True break it? How can I use it in template? I need the primary key to make the DetailView. Or am I completely wrong about everything?
#Template {% for set in sets_list %} #... <b>Theme:</b> <a href="/themes/{{ set.theme }}/">{{ set.theme }}</a><br /> <b>Subtheme:</b> <a href="/subthemes/{{ set.subtheme }}/">{{ set.subtheme }}</a> #... {% endfor %} #Models class Set(models.Model): #... theme = models.ForeignKey('Theme') #... class Theme(models.Model): name = models.CharField(max_length=32, primary_key=True, help_text="Primary key.") #... #Views urlpatterns = patterns('', (r'^sets/$', ListView.as_view( model=Set, context_object_name="sets_list", template_name='data/sets_list.html', )), (r'^sets/(?P<pk>\d+)/$', DetailView.as_view( model=Set, context_object_name="set_details", template_name='data/set_details.html', )), ) urlpatterns += patterns('', (r'^themes/$', ListView.as_view( model=Theme, context_object_name="themes_list", template_name='data/themes_list.html', )), (r'^themes/(?P<pk>\d+)/$', DetailView.as_view( model=Theme, context_object_name="theme_details", template_name='data/theme_details.html', )), ) -- 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/-/Clny6BH948QJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.