On Aug 6, 5:46 pm, kostia <kostya.demc...@gmail.com> wrote:
> What is wrong?
>
> My view function:
> def project(request, project_id):
>
>     try:
>
>         project_id = int(project_id)
>
>     except ValueError:
>
>         raise Http404
>
>     myProject = get_object_or_404(Project, id = project_id)
>     events = Event.objects.filter(project = myProject)
>
>     return render_to_response('project.html',
>
>         context_instance=RequestContext(request, {'project':
> myProject, 'events': events}))
>
> And in the template I do:
> <div id="sidebar">
>         <ul>
>                 {% for event in events %}
>                 <li><a href="{% url event event.pk %}">{{ event.title 
> }}</a></li>
>                 {% empty %}
>                 <p>{% trans "There are no events yet." %}</p>
>                 {% endfor %}
>         </ul>
> </div>
>
> If there are no events, everything is fine. If some event exists, it
> shows an error:
>
> Caught NoReverseMatch while rendering: Reverse for 'event' with
> arguments '(1,)' and keyword arguments '{}' not found.
>
> and points to the for tag.

Do you have a URL named 'event'? Does it take a single non-keyword
parameter? Show your urls.py.
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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