django.contrib.admindocs
All: I'm trying to get the documentation portion of the admin up and running. I've installed the django.contrib.admindocs application, but when I visit the admin/docs/ url I end up getting a message about installing docutils. It would appear that admindocs is running, it's just irritated about not being able to find docutils. So... I installed docutils at: /usr/lib/python2.5/site-packages/docutils The docutils test suite runs fine, and it seems like django should have access to this because it's in my primary Python path (/usr/lib/ python2.5/site-packages). Any thoughts? thanks! -dls --~--~-~--~~~---~--~~ 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: simple reverse( ) errors
Malcolm: What you have described is accurate - my application did indeed just pick one, selecting the first (empty) regex, and routing me back to the page I was already on (in one particular case). No error was thrown - the behavior was just not as I expected. It was only during my attempts to use reverse( ) as a debugging mechanism that the error messages appeared. What is this "free time" you speak of? Thanks, dan On Nov 23, 8:17 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Sun, 2008-11-23 at 12:42 -0700, Dj Gilcrease wrote: > > You should not have both; > > (r'^$', include('basicBlog.blog.urls')), > > (r'^blog/', include('basicBlog.blog.urls')), > > > since now your reverse is going to match two diffrent URL, > > /2008/nov/21/secondPost/ > > and > > /blog/2008/nov/21/secondPost/ > > thus cause the NoReverseMatch error since reverse should match one and > > only one url > > Hmmm. Since that resolved the original poster's problem, it's got me > worried. This shouldn't be the case. Sometimes there will be more than > URL directing to exactly the same view and set of variables. It's a bit > messy (redirects would work better), but it's not inconceivable and not > really wrong, per se. Reversing those patterns should just pick one and > move on. Either one would be correct. > > Note that this is what already happens if you have a pattern like > > '/foo/[abc]/(\w+)' > > for example. Reversing that will always give '/foo/a/...', although > '/foo/b/...' and '/foo/c/...' would also be correct. The point is, we > just pick one. The caller doesn't get to choose, since they've said all > the patterns were equivalent. > > Thus, this is a bug in reverse(), possibly. So now I have to do more > work and fix it. I remember when I used to have free time. My > recollection is that those were happier days. :-( > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: simple reverse( ) errors
excellent! that was indeed the issue - thank you both for your explanations. On Nov 23, 2:42 pm, "Dj Gilcrease" <[EMAIL PROTECTED]> wrote: > You should not have both; > (r'^$', include('basicBlog.blog.urls')), > (r'^blog/', include('basicBlog.blog.urls')), > > since now your reverse is going to match two diffrent URL, > /2008/nov/21/secondPost/ > and > /blog/2008/nov/21/secondPost/ > thus cause the NoReverseMatch error since reverse should match one and > only one url > > Dj Gilcrease > OpenRPG Developer > ~~http://www.openrpg.com --~--~-~--~~~---~--~~ 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: simple reverse( ) errors
I'm not sure I understand what you're suggesting - can you provide a brief example, or highlight the specific lines where this change would go? On Nov 23, 12:35 pm, "Valts Mazurs" <[EMAIL PROTECTED]> wrote: > Hello, > > Quick solution: use redirect from "/" to "/blog" or vice versa. > > -- > Valts > > On Sun, Nov 23, 2008 at 19:16, goblue0311 <[EMAIL PROTECTED]> wrote: > > > This post is an update to "NoReverseMatch question", which was an epic > > fail in terms of resolving my issue. I blame myself for posting an > > overly complex question. I will try again... > > > I am trying to use reverse( ) in this manner: > > > >> python manage.py shell > > >> from django.core.urlresolvers import reverse > > >> reverse('blog_detail',kwargs={'year':2008, 'month':'nov', 'day':21, > > 'slug':u'secondPost'}) > > > and I receive a "NoReverseMatch: Reverse for 'blog_detail' with > > arguments '()' and keyword arguments ... not found" (except it > > actually lists the keyword arguments). > > > I'm using a simple Django app with a root urls.py (simplified below): > > > urlpatterns = patterns('', > > (r'^$', include('basicBlog.blog.urls')), > > (r'^blog/', include('basicBlog.blog.urls')), > > ... > > ) > > > and basicBlog.blog urls.py (also simplified): > > > urlpatterns = patterns('', > > url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? > > P[-\w]+)/$', > > view=blog_views.post_detail, > > name='blog_detail'), > > ... > > ) > > > I see no reason why this reverse should fail - the view name is > > accurate, I think the view is importable, and the pattern looks like > > a match. I've been working on this for a few days, so any suggestions > > are welcome. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
simple reverse( ) errors
This post is an update to "NoReverseMatch question", which was an epic fail in terms of resolving my issue. I blame myself for posting an overly complex question. I will try again... I am trying to use reverse( ) in this manner: >> python manage.py shell >> from django.core.urlresolvers import reverse >> reverse('blog_detail',kwargs={'year':2008, 'month':'nov', 'day':21, >> 'slug':u'secondPost'}) and I receive a "NoReverseMatch: Reverse for 'blog_detail' with arguments '()' and keyword arguments ... not found" (except it actually lists the keyword arguments). I'm using a simple Django app with a root urls.py (simplified below): urlpatterns = patterns('', (r'^$', include('basicBlog.blog.urls')), (r'^blog/', include('basicBlog.blog.urls')), ... ) and basicBlog.blog urls.py (also simplified): urlpatterns = patterns('', url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', view=blog_views.post_detail, name='blog_detail'), ... ) I see no reason why this reverse should fail - the view name is accurate, I think the view is importable, and the pattern looks like a match. I've been working on this for a few days, so any suggestions are welcome. 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: NoReverseMatch question
ok, the view function I'm using appears to be importable - because if I remove the line "print item.get_absolute_url()", the view function is called appropriately, with the odd exception that all instances where the template is calling "get_absolute_url( )" are resolving to the same page. A clue may be that in the application urls.py file, when I replace "view=blog_views.post_list" with "view=basicBlog.blog.views.post_list" it claims to not be able to find "basicBlog" Here's the complete code, I'm quite stuck on this and appreciate your help: urls.py from project root #* from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^$', include('basicBlog.blog.urls')), (r'^blog/', include('basicBlog.blog.urls')), (r'^comments/', include('django.contrib.comments.urls')), (r'^admin/(.*)', admin.site.root), ) #* urls.py from blog application #* from django.conf.urls.defaults import * from basicBlog.blog import views as blog_views urlpatterns = patterns('', url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', view=blog_views.post_detail, name='blog_detail'), url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/$', view=blog_views.post_archive_day, name='blog_archive_day'), url(r'^(?P\d{4})/(?P[a-z]{3})/$', view=blog_views.post_archive_month, name='blog_archive_month'), url(r'^(?P\d{4})/$', view=blog_views.post_archive_year, name='blog_archive_year'), url(r'^categories/(?P[-\w]+)/$', view=blog_views.category_detail, name='blog_category_detail'), url (r'^categories/$', view=blog_views.category_list, name='blog_category_list'), url (r'^search/$', view=blog_views.search, name='blog_search'), url(r'^page/(?P\w)/$', view=blog_views.post_list, name='blog_index_paginated'), url(r'^$', view=blog_views.post_list, name='blog_index'), ) #* and views.py for the post_list view: #* from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import Http404 from django.views.generic import date_based, list_detail from basicBlog.blog.models import * import datetime import re def post_list(request, page=0): queryset = Post.objects.published() for item in queryset: print item.get_absolute_url() return list_detail.object_list( request, queryset, paginate_by = 20, page = page, ) post_list.__doc__ = list_detail.object_list.__doc__ # this file goes on... #* --~--~-~--~~~---~--~~ 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: NoReverseMatch question
good call - I repeated my concern below before I saw your response, so please disregard. On Nov 21, 9:35 am, Jarek Zgoda <[EMAIL PROTECTED]> wrote: > Wiadomość napisana w dniu 2008-11-21, o godz. 15:22, przez goblue0311: > > > Another note if interest is that the error message is citing the > > keyword arguments in the order year, slug, day, and month. However, > > get_absoloute_url and the urls.py function use year, month, day, and > > slug. Maybe I have some outdated code here, but where would it reside? > > Python doctionaries do not have any notion of "ordering". > > -- > We read Knuth so you don't have to. - Tim Peters > > Jarek Zgoda, R, Redefine > [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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: NoReverseMatch question
Thanks for the suggestion! This code came from the basicApps collection, so I'm not sure why they're using a Word regex to match the day, I'm going to try changing that to Digit. However, I did remove the underscore from my slug, so now it's just 'secondPost', and I get the same error. I also tried deleting all the *.pyc files, because I'm a little concerned about the re-ordering of the error message, although maybe that's nothing. On Nov 21, 9:24 am, "Alex Koshelev" <[EMAIL PROTECTED]> wrote: > You have an underscore in slug - "second_post" but your regex doesn't allow > it - "[-\w]+". I think it is the problem. > And why you did you choose "\w" for day? > > On Fri, Nov 21, 2008 at 17:16, goblue0311 <[EMAIL PROTECTED]> wrote: > > > Hi all: > > > I'm receiving this error: > > > #* > > NoReverseMatch at /blog/ > > Reverse for 'blog_detail' with arguments '()' and keyword arguments > > '{'year': 2008, 'slug': u'second_post', 'day': 21, 'month': 'nov'}' > > not found." > > #* > > > when I try to call this function from views.py: > > > #* > > def post_list(request, page=0): > > queryset = Post.objects.published() > > > for item in queryset: > > print item.get_absolute_url() > > > return list_detail.object_list( > > request, > > queryset, > > paginate_by = 20, > > page = page, > > ) > > #* > > > with this urls.py: > > > #* > > url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? > > P[-\w]+)/$', > > view=blog_views.post_detail, > > name='blog_detail'), > > #* > > > This may be an odd thing to do, but I'm trying to debug an issue where > > my blog_index view doesn't let me see the detailed view for any of the > > blog entries. In any case, I think my URLconf and model definition of > > get_absolute_url( ) are aligned, but maybe that's not the case. > > > Suggestions? > > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: NoReverseMatch question
Another note if interest is that the error message is citing the keyword arguments in the order year, slug, day, and month. However, get_absoloute_url and the urls.py function use year, month, day, and slug. Maybe I have some outdated code here, but where would it reside? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
NoReverseMatch question
Hi all: I'm receiving this error: #* NoReverseMatch at /blog/ Reverse for 'blog_detail' with arguments '()' and keyword arguments '{'year': 2008, 'slug': u'second_post', 'day': 21, 'month': 'nov'}' not found." #* when I try to call this function from views.py: #* def post_list(request, page=0): queryset = Post.objects.published() for item in queryset: print item.get_absolute_url() return list_detail.object_list( request, queryset, paginate_by = 20, page = page, ) #* with this urls.py: #* url(r'^(?P\d{4})/(?P[a-z]{3})/(?P\w{1,2})/(? P[-\w]+)/$', view=blog_views.post_detail, name='blog_detail'), #* This may be an odd thing to do, but I'm trying to debug an issue where my blog_index view doesn't let me see the detailed view for any of the blog entries. In any case, I think my URLconf and model definition of get_absolute_url( ) are aligned, but maybe that's not the case. Suggestions? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: Django template tag question
yeah, it was definitley the __init__.py issue, which I will strive to never forget again. Thanks! On Nov 19, 3:52 pm, Ben Eliott <[EMAIL PROTECTED]> wrote: > what happens when you go into the python interpreter and write > import basic > > On 19 Nov 2008, at 16:58, goblue0311 wrote: > > > > > I'm implementing the popular basic.blog application, which requires > > the inclusion of the basic.inlines project. However, I cannot seem to > > get my application to locate the basic.inlines project. I have asked > > this question in the basic.apps group, but I think it's generic enough > > to be posted here as well. > > > I have installed the module in my site-packages directory, which is on > > my PYTHONPATH. The basic.inlines module is located in a folder called > > 'basic' as per the installation instructions, and basic.inlines is > > included in INSTALLED_APPS. > > > However, while trying to run syncdb, I get an error stating "no module > > named basic". The question is, how is Django trying to locate this > > package? I was assuming it used PYTHONPATH in conjunction with some > > generic paths, but perhaps I'm missing a step here. Any hints or > > suggestions on how to resolve this? > > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Django template tag question
I'm implementing the popular basic.blog application, which requires the inclusion of the basic.inlines project. However, I cannot seem to get my application to locate the basic.inlines project. I have asked this question in the basic.apps group, but I think it's generic enough to be posted here as well. I have installed the module in my site-packages directory, which is on my PYTHONPATH. The basic.inlines module is located in a folder called 'basic' as per the installation instructions, and basic.inlines is included in INSTALLED_APPS. However, while trying to run syncdb, I get an error stating "no module named basic". The question is, how is Django trying to locate this package? I was assuming it used PYTHONPATH in conjunction with some generic paths, but perhaps I'm missing a step here. Any hints or suggestions on how to resolve this? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---