Sven Richter wrote: > Hi, > > i get the following error message: > TemplateSyntaxError at /community/profile/sveris/ > Caught an exception while rendering: Reverse for 'youriq.profile_myiq' with > arguments '('',)' and keyword arguments '{}' not found. > > Original Traceback (most recent call last): > File "/usr/lib/python2.5/site-packages/django/template/debug.py", line 71, > in render_node > result = node.render(context) > File "/usr/lib/python2.5/site-packages/django/template/defaulttags.py", > line 378, in render > args=args, kwargs=kwargs) > File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line > 252, in reverse > *args, **kwargs))) > File "/usr/lib/python2.5/site-packages/django/core/urlresolvers.py", line > 241, in reverse > "arguments '%s' not found." % (lookup_view, args, kwargs)) > NoReverseMatch: Reverse for 'youriq.profile_myiq' with arguments '('',)' and > keyword arguments '{}' not found. > > when i try to call: > {% url profile_myiq argument %} > > from a template. > > > These are all important modules i hope: > settings.py > INSTALLED_APPS = ( > 'accounts' > 'community' > 'profile', > 'shared', > ) > > urls.py > urlpatterns = patterns('', > (r'^admin/(.*)', admin.site.root), > (r'^community/', include('community.urls')), > ) > > community/urls.py > urlpatterns = patterns('community.views', > (r'^$', direct_to_template, {'template':'community/community.html'}, > 'community'), > (r'^accounts/', include('accounts.urls')), > (r'^profile/', include('profile.urls')), > ) > > profile/urls.py > urlpatterns = patterns('profile.views', > (r'^$', direct_to_template, {'template':'profile/profile_all.html'}, > 'profile_all'), > (r'^(?P<name>\w+)/$', 'user', {} 'profile_myiq'), > ) > > profile/views.py > def user(request, name): > > return render_to_response('profile/profile_user.html', {'name':name}, > RequestContext(request)) > > > Thanks to the people from the irc i could solve the problem. The template call has to look like that:
{% url profile_myiq "argument" %} if argument is a string it has to be quoted, and if it's an variable it doesn't need quotes which is some sort of logic. The documentation about that is a bit misleading. It says something like: {% url profile_myiq 1994 %} which led me to the conclusion the argument doesn't have to be quoted anyway. Greetings Sven --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---