Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango tutorial. 404 on Generic Views
    primarykey
    data
    text
    <p>Update: Using Django 1.2.1 and Python 2.5.2 as offered by Dreamhost.</p> <p>I'm having issues with the last part of the Django tutorial where the urls.py is changed to use generic views. After I change the code I get 404's on the pages and even the index stops working.</p> <p>I have gone over all of my templates to see if that was the issue but I removed any instance of poll and replaced it with object. I have also attached the template for the index/object_list.</p> <p>I am running this on Dreamhost and the static urls I set with views worked fine.</p> <p>urls.py</p> <pre><code>from brsplash.models import Poll from django.conf.urls.defaults import * from django.contrib import admin from django.views.generic import * admin.autodiscover() info_dict = { 'queryset': Poll.objects.all(), } urlpatterns = patterns('', (r'^$', 'django.views.generic.list_detail.object_list', info_dict), (r'^(?P&lt;object_id&gt;\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict), url(r'^(?P&lt;object_id&gt;\d+)/results/$', 'django.views.generic.list_detail.object_detail', dict(info_dict, template_name='brsplash/results.html'), 'poll_results'), (r'^(?P&lt;poll_id&gt;\d+)/vote/$', 'brsplash.views.vote'), ) urlpatterns += patterns('', (r'^admin/', include(admin.site.urls)), </code></pre> <p>poll_list.html</p> <pre><code> {% if object_list %} &lt;ul&gt; {% for object in object_list %} &lt;li&gt;&lt;a href="{{ object.id }}/"&gt;{{ object.question }}&lt;/a&gt;&lt;/li&gt; {% endfor %} &lt;/ul&gt; {% else %} &lt;p&gt;No polls are available&lt;/p&gt; {% endif %} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload