My best guess is that, for whatever reason, 'timetable_view' in your url conf
has not been converted into the view function.  Try actually importing the
view in urls.py and putting it as the target of the pattern *without*
the quotes.
If this works, then figuring out whether you needed 'app_name.timetable_view'
or some such is where to look.  If it still doesn't work, you may get additional
insights (can you actually import views.py, or does it have a syntax
error, etc.).

On Tue, Sep 4, 2012 at 2:06 AM, zayatzz <alan.kesselm...@gmail.com> wrote:
> From this post i can see this line beeing wrong .
>
> timetable = get_object_or_404(slug=slug)
>
> You also need to give object as one of the parameters for get_object_or_404
> shortcut: like this :
> https://docs.djangoproject.com/en/dev/intro/tutorial03/?from=olddocs#a-shortcut-get-object-or-404
>
> Alan
>
>
> On Tuesday, September 4, 2012 7:30:22 AM UTC+3, Lachlan Musicman wrote:
>>
>> 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 view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/gEKT5Z85E14J.
>
> 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.

-- 
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