task_list not Task.object.all in the view.

2009/6/27 Technicalbard <rodwe...@gmail.com>:
>
> 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...
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to