Hi all,
Stumped on this one:
Traceback:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/tafe/timetable/2012-4/
Django Version: 1.4
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'tafe',
'south',
'crispy_forms')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/home/datakid/src/envs/mlhrd/local/lib/python2.7/site-packages/django/core/handlers/base.py"
in get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
Exception Type: TypeError at /tafe/timetable/2012-4/
Exception Value: 'str' object is not callable
urls.py:
...
url(r'^timetable/(?P<slug>[-\w]+)/$', 'timetable_view'),
...
views.py:
@login_required
def timetable_view(request, slug):
timetable = get_object_or_404(slug=slug)
sessions = timetable.sessions.all()
return render_to_response('tafe/timetable_detail.html',{'timetable':timetable,'sessions':sessions})
models.py:
class Session(models.Model):
...
timetable = models.ForeignKey(Timetable, related_name='sessions')
...
What am I doing wrong?
cheers
L.
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment