My Model
class Player(models.Model):
player_name = models.CharField(max_length=50)
player_email = models.CharField(max_length=50)
def __unicode__(self):
return self.player_name
My Root urls.py
urlpatterns = patterns('',
(r'^kroster/', include('djangosite.kroster.urls')),
(r'^admin/(.*)', admin.site.root),
)
My kroster urls.py
from djangosite.kroster.models import Player
info_dict = {
'queryset': Player.objects.all(),
}
urlpatterns = patterns('',
(r'^$', 'django.views.generic.list_detail.object_list', info_dict),
(r'^(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', info_dict),
)
My player_list.html template
<h1>Player List</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<ul>
{% for player in object.player_set.all %}
<li id="{{ player.id }}">{{ forloop.counter }} .) {{ player }}</li>
{% endfor %}
</ul>
Sadly my template output is this.
<h1>Player List</h1>
<ul>
</ul>
Apologies if this is a stupid mistake. It has to be something wrong w/ my template.