seem like it should work… but..
here is the views.py
from django.shortcuts import render_to_response
from django.template import RequestContext
from create_lesson.models import Lesson
from django.contrib.auth.models import User
from add_material.models import Materials
def Use_Lesson(request, lesson):
user=request.user
lessons = Lesson.objects.get(slug=lesson)
lessons.attributes=Materials.objects.filter(lesson=lessons.pk)
context = {'user':user,'lesson':lessons,}
return render_to_response('use_lesson/use_lesson.html', context, context_instance=RequestContext(request))
urls.py looks like this
from django.conf.urls.defaults import *
urlpatterns= patterns('',
(r'^browse/', 'use_lesson.views.Browse'),
(r'^lesson/(?P<lesson>[a-zA-Z0-9-]+)', 'use_lesson.views.Use_Lesson'),
here is the basic error message
Request Method: GET
Request URL: …/lesson/superfarts
Django Version: 1.4.1
Exception Type: DoesNotExist
Exception Value: Lesson matching query does not exist.
and it is saying the problem is here: lessons = Lesson.objects.get(slug=lesson)
when i do the same the same query in “python manage.py shell”
i get the results i am looking for.
Try to change it as: