Re: How to use URL namespaces in tests?
Ok it is quite easy, you are missing {% load url from future %} in your template. Le jeudi 23 août 2012 09:25:54 UTC+2, e.generalov a écrit : > > Url patterns which provided by a django application should be > addressedexternally in > the form of "namespace:name". I guess it will be connected to the project as > follows: > > project/urls.py > > urlpatterns = patterns('', > url('^something/', include('django_something.urls', > namespace='something'))) > > URL patterns module in the application looks like: > > django_something/urls.py > > urlpatterns = patterns('', > url('^$', show, name='show')) > > and I write a test: > > django_something/tests.py > > class ShowViewTest(TestCase): > urls = 'django_something.urls' > > def test_should_render_something_template(self): > url = reverse('something:show') # !!! > response = self.client.get(url) > self.assertIn('something.html', set([t.name for t in > response.templates])) > > This test failes with exception "django NoReverseMatch 'something' is not > a registered namespace" . How can I specify namespace 'something' in this > case? -- 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/-/J7Uo3tFSGzgJ. 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: How to use URL namespaces in tests?
I've got the same problem any ideas ? Le jeudi 23 août 2012 09:25:54 UTC+2, e.generalov a écrit : > > Url patterns which provided by a django application should be > addressedexternally in > the form of "namespace:name". I guess it will be connected to the project as > follows: > > project/urls.py > > urlpatterns = patterns('', > url('^something/', include('django_something.urls', > namespace='something'))) > > URL patterns module in the application looks like: > > django_something/urls.py > > urlpatterns = patterns('', > url('^$', show, name='show')) > > and I write a test: > > django_something/tests.py > > class ShowViewTest(TestCase): > urls = 'django_something.urls' > > def test_should_render_something_template(self): > url = reverse('something:show') # !!! > response = self.client.get(url) > self.assertIn('something.html', set([t.name for t in > response.templates])) > > This test failes with exception "django NoReverseMatch 'something' is not > a registered namespace" . How can I specify namespace 'something' in this > case? -- 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/-/sbDyYDqLnzMJ. 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: gettext is not defined - js error in admin calendar.js
I did it :D Here are my information : Here is my Form.Field definition : dob = forms.DateField(label="Date of birth", input_formats=['%Y-%m- %d'], widget=forms.DateTimeInput(attrs={'class':'vDateField'})) And that's it :D On 13 oct, 08:52, Natim <[EMAIL PROTECTED]> wrote: > You have to do like that : > > > > And define in you urls.py > > (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages': > 'django.conf'}), > > Let me know if it does works :) > > On 8 sep, 14:37, ykb <[EMAIL PROTECTED]> wrote: > > > Could you please let us know in a little more detail on how to set the > > jsi18n path. > > Where is "/admin/jsi18n/" referring to? > > > Thanks, > > Yadu. > > > On Aug 20, 1:38 am, "[EMAIL PROTECTED]" > > > <[EMAIL PROTECTED]> wrote: > > > That did it. Many Thanks! > > > > On Aug 19, 3:09 pm, Daniel Roseman <[EMAIL PROTECTED]> > > > wrote: > > > > > On Aug 19, 5:28 pm, "[EMAIL PROTECTED]" > > > > > <[EMAIL PROTECTED]> wrote: > > > > > Hello, > > > > > > I'm trying to use the datetime picker widget from the admin widgets. > > > > > > My form is displaying, but the datetime picker is not. When I check > > > > > the error console, I see the message: > > > > > > Error: gettext is not defined > > > > > Source File:http://localhost:8001/media/js/calendar.js > > > > > Line: 26 > > > > > > And another in DateTimeShortcuts. > > > > > > Searching this group I > > > > > found:http://groups.google.com/group/django-users/browse_thread/thread/f0ab... > > > > > > But I'm running the latest update from the trunk. > > > > > > In my HTML output I see: > > > > > > > > > > > > > > > > > > > > > > The second two lines are coming from the media property of my form > > > > > object, and I inserted the first to quiet another JS error. > > > > > > I've searched all the JS in my Django check out and I can't find > > > > > gettext described there. I turned internationalization off in my > > > > > settings file. Any one have any ideas? > > > > > > -Justin > > > > > The admin templates have this extra line: > > > > > > > > which refers to an actual Django admin view which renders Javascript, > > > > rather than an included JS file. I think if you resolve the path it > > > > ends up as /admin/jsi18n/ - would definitely be worth including that > > > > before your other script tags and see if that helps. > > > > > -- > > > > DR. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: gettext is not defined - js error in admin calendar.js
You have to do like that : And define in you urls.py (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', {'packages': 'django.conf'}), Let me know if it does works :) On 8 sep, 14:37, ykb <[EMAIL PROTECTED]> wrote: > Could you please let us know in a little more detail on how to set the > jsi18n path. > Where is "/admin/jsi18n/" referring to? > > Thanks, > Yadu. > > On Aug 20, 1:38 am, "[EMAIL PROTECTED]" > > <[EMAIL PROTECTED]> wrote: > > That did it. Many Thanks! > > > On Aug 19, 3:09 pm, Daniel Roseman <[EMAIL PROTECTED]> > > wrote: > > > > On Aug 19, 5:28 pm, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > > Hello, > > > > > I'm trying to use the datetime picker widget from the admin widgets. > > > > > My form is displaying, but the datetime picker is not. When I check > > > > the error console, I see the message: > > > > > Error: gettext is not defined > > > > Source File:http://localhost:8001/media/js/calendar.js > > > > Line: 26 > > > > > And another in DateTimeShortcuts. > > > > > Searching this group I > > > > found:http://groups.google.com/group/django-users/browse_thread/thread/f0ab... > > > > > But I'm running the latest update from the trunk. > > > > > In my HTML output I see: > > > > > > > > > > > > > > > > > > The second two lines are coming from the media property of my form > > > > object, and I inserted the first to quiet another JS error. > > > > > I've searched all the JS in my Django check out and I can't find > > > > gettext described there. I turned internationalization off in my > > > > settings file. Any one have any ideas? > > > > > -Justin > > > > The admin templates have this extra line: > > > > > > which refers to an actual Django admin view which renders Javascript, > > > rather than an included JS file. I think if you resolve the path it > > > ends up as /admin/jsi18n/ - would definitely be worth including that > > > before your other script tags and see if that helps. > > > > -- > > > DR. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---