Actually, As he didn't provide a template_object_name parameter, the
generic view's default context variable is object_list.

 -justin

On Fri, Jun 26, 2009 at 8:18 PM, maplye<[email protected]> wrote:
>
> task_list not Task.object.all in the view.
>
> 2009/6/27 Technicalbard <[email protected]>:
>>
>> Hey all,
>>
>> I did the tutorial, yet when I try to apply what I've learned (or
>> think I've learned), to my own application it doesn't work...
>>
>> My code looks like this:
>>
>> # taskmgr/models.py
>> class Task(models.Model):
>>    name = models.CharField(max_length=216)
>>    summary = models.CharField(max_length=3072, blank=True)
>>    origin = models.CharField(max_length=96, blank=False)
>> # more stuff
>>
>> # taskmgr/urls.py
>> from django.conf.urls.defaults import *
>> from django.views.generic import list_detail
>> from mysite.taskmgr.models import Task
>>
>> urlpatterns = patterns('taskmgr.views',
>>        url(r'^$', list_detail.object_list, { "queryset" :
>> Task.objects.all() }, name="task_list"),
>> # more urls
>>
>> # task_list.html
>>  <body>
>>  <p>This is the task list</p>
>>    <ul>{% for object in Task.object.all %}
>>        <li>{{ object.id }} -- {{ object.name }} is due:
>> {{ object.date_comp_req }}</li>
>>        {% endfor %}
>>    </ul>
>>  </body>
>>
>> I know it is picking up the template, because it displays the text in
>> the <p> line  But it displays nothing else.
>>
>> If I do this in the shell:
>>
>>>>>p = Task.objects.get(pk=1)
>> [<Task: Build Task Manager>, <Task: Test Task Manager>]
>>
>>>>>p.name
>> u'Build Task Manager'
>>
>> So I know that Task.objects gets me something...   What do I need to
>> change to pass this to the template properly...
>>
>>
>> >
>>
>
> >
>



-- 
Justin Lilly
Python/Django Developer
http://justinlilly.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to