Hi,

I am working my way through Practical Django Projects, 2nd addition,
and I am having troubles getting the weblog permalink url to function.

>From my urls.py:

===============

entry_info_dict = {
        'queryset': Entry.objects.all(),
        'date_field': 'pub_date',
}
...
...
(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/
$', 'object_detail', entry_info_dict, 'coltrane_entry_detail'),
...
...

===============

>From my models.py:

===============

def get_absolute_url(self):
        return ('coltrane_entry_detail', (),
                {
                        'year': self.pub_date.strftime('%Y'),
                        'month': self.pub_date.strftime('%m'),
                        'day': self.pub_date.strftime('%d'),
                        'slug': self.slug
                }
        )
get_absolute_url = models.permalink(get_absolute_url)

===============

When I visit this URI:

<http://site.com/weblog/2010/05/09/test-entry-fo-sho/>

I get the 404 "page not found" error.

I think the problem is due to the month digit... The book opted to use
the 3-letter month name vs the two digits... I personally like the
month as digits so I changed the urls.py and models.py to use %m.

I have been scratching my head now for a few days (on and off) trying
to figure out why the uri above returns a 404... Any tips? I just want
to make sure I am not crazy here... The URI pattern looks correct to
me.

TIA!

M

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
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.

Reply via email to