morenopc / django-calendar-app

Good calendar made in Django
http://www.lightbird.net/dbe/cal1.html
6 stars 4 forks source link

Reverse Errors #1

Closed leftnutlow closed 7 years ago

leftnutlow commented 13 years ago

I've been playing around with your code for a while now and I'm not able to fix this error:

TemplateSyntaxError at /profile/joe/calendar/ Caught NoReverseMatch while rendering: Reverse for 'cal.views.month' with arguments '(2011, 1)' and keyword arguments '{}' not found.

I first took the code from your website and got this error, then I found this updated code on github that said you fixed the reverse errors. Have you seen this error when in development? How did you fix it?

morenopc commented 13 years ago

Hi.

Yes, I had the same problem.

Basically you have to change all cal.views.<function name> to cal:<function name> at templates. For example: {% url cal.views.day year month day %} to {% url cal:day year month day %} where "cal" is the app name.

And change view's reverse to return HttpResponseRedirect(reverse("cal:month", args=(year, month)))

The fixes are available here in the github source code.

Source: https://docs.djangoproject.com/en/dev/topics/http/urls/#naming-url-patterns

leftnutlow commented 13 years ago

Sorry I'm a little new to using urls like this in Django, and I'm getting this error Caught NoReverseMatch while rendering: u'cal' is not a registered namespace I have an app named 'cal' and it looks like django looks for registered apps' names for namespaces. Any idea on this?

morenopc commented 13 years ago

I think the problem is that you are using some old part of the code in your .../cal/urls.py I made some changes in this file too. Compare your urls.py with github source urls.py and check the differences if the problem persists let me see your .../cal/ views, urls and template by http://chopapp.com/ or other.