Re: Problem with url tag
Resolved, if I could say so :) the problem was that I can't use reverse in forms.py 'cause is to early for doing that :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with url tag
Almost resolved :) I tried everything to find the error and finally I did, but I don't know how to resolve :( the error is casued by this line in a imported script: CITY_URL = reverse('get_city_list') if I remove that line the project works fine, but I need that line :( Ps. the url get_city_list is correct indeed when I call this template: {% url get_city_list %} i get the url without errors, also when, from a view I call this code: print reverse('get_city_list') in the console I could see the correct url. PS. The file with the line: CITY_URL = reverse('get_city_list') is in the same directory as the urls.py with the get_city_list url could this help? Thanks for any reply :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with url tag
This is really boring :( I've restarted the server, and it doens't work again :/ also I've noticed that no urls in reparations.urls can't be called with the template tag url... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with url tag
What a strangeness! I edit the template removing the extend tag, and it worked, next I readded the extend and it still worked :O this is really strange :/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with url tag
On 22 Dic, 09:24, Malcolm Tredinnickwrote: > Okay, nothing unexpected there. If I use the same lines with a dummy > view file, things certainly seem to work. > > The confusing thing here is that the url template tag is a relatively > simple wrapper around reverse(), so there aren't many places for things > to go wrong. Still, let's see what might be happening. I'm assuming in > what follows that you're either running Django 1.0.2 or something later > from the 1.0.X branch or Django trunk. All those versions have basically > the same code in place with all the relevant fixes for reverse(). > > Add some debug printing to django/template/defaulttags.py in the URLNode > class. In particular, in the render() method where it says > > args = [arg.resolve(context) for arg in self.args] > > (line 361 in 1.0.X, line 371 in trunk). > > What I'm interested in seeing is what are the values and types of the > elements in the args list. So the output of something like > > print [(repr(x), type(x)) for x in args] > Instead of editing django core, could I create a template tag? I think it is better > would be interesting. Somehow -- and I don't know how or why, yet -- the > value of worksheet.number might not be turning out as expected. Although > the error message does make it seem like you're passing in a number > correctly. > > I'll admit I'm grasping at straws a bit here, but this is the kind of > thing that you really have to debug at the source, line by line. > Ideally, we need to work out if the exact same data, of the exact same > type is being passed into the reverse() calls for the tag version. If it > is the exact same piece of data, there's something else going on. > Somehow, when you're running under the web server, the setup is subtly > different to the shell code. That's going to be a little tougher to > debug. > > Oh ... other idea. Try some experiments like this: > > In [3]: from django.template import Template, Context > > In [4]: t = Template("{% url show_worksheet 5537 %}") > > In [5]: t.render(Context()) > Out[5]: u'/foglio/5537/' > > That shows the url tag is working in my setup when I pass in a constant > argument. Perhaps you can arrange a shell-prompt version with > worksheet.number set up exactly as in the template that is failing for > you. Would be interesting to see if you can make things fail for the url > tag at the shell prompt whilst reverse() for the same thing works. > I tried it and it worked :) also i tried with passing the WorkSheet object: >>> from django.template import Template, Context >>> from reparations.models import WorkSheet >>> w = WorkSheet.objects.get(pk=1) >>> c = Context({ 'w': w }) >>> t = Template("{% url show_worksheet w.number %}") >>> t.render(c) u'/riparazioni/foglio/5537/' > Regards, > Malcolm --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with url tag
On 22 Dic, 02:17, Malcolm Tredinnickwrote: > Certainly a bit unexpected. Can you paste the relevant lines from your > URL Conf file, please? > > Regards, > Malcolm Sure :) here it is: url(r'foglio/(?P[0-9]+)/$', views.show_worksheet, name='show_worksheet'), Thanks for the reply --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Problem with url tag
Hi, I've a problem with the url tag, when I call this template: Visualizza I get this error: Caught an exception while rendering: Reverse for 'catsnc.show_worksheet' with arguments '(5537,)' and keyword arguments '{}' not found. But when I call this code from the shell: >>> from django.core.urlresolvers import reverse >>> reverse('show_worksheet', args=(5537,)) I get the url: '/riparazioni/foglio/5537/' could you help me to resolve this problem? Thanks :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Problem with self.field.save()
nothing? :( --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---