This is the code I am using. Sorry for not accompanying my discussion
with code examples.

I'm not trying to piss anyone off here, just need a bit of help to get
this moving. Sorry if I've pushed a bit much on this issue, I just
can't seem to find a resolution.

#### URLS #####

from django.conf.urls.defaults import *
from tagging.views import tagged_object_list
from blog.models import Post

urlpatterns = patterns('blog.views',
  url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?
P<slug>[-\w]+)/$',
    view    =  'post_detail',
    name    = "blog_detail",
  ),
  url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$',
    view    =  'post_archive_day',
    name    = "blog_archive_day",
  ),
  url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$',
    view    =  'post_archive_month',
    name    = "blog_archive_month",
  ),
  url(r'^(?P<year>\d{4})/$',
    view    =  'post_archive_year',
    name    =  "blog_archive_year",
  ),
  url(r'^tag/(?P<tag>[^/]+)/$',
        tagged_object_list,
        dict(queryset_or_model=Post, paginate_by=10, allow_empty=True,
template_name='blog/taggedpost_list.html'), name='taggedpost_list',
  ),
  url(r'^page/(?P<page>\w)/$',
    view    =  'post_list',
    name    = "blog_index_paginated",
  ),
  url(r'^$',
    view    = 'post_list',
    name    = "blog_index"
  ),
)

### Views ###

def post_archive_year(request, year):
  """
  Post archive year

  Templates: ``blog/post_archive_year.html``
  Context:
    date_list
      List of months in this year with objects
    year
      This year
    object_list
      List of objects published in the given month
      (Only available if make_object_list argument is True)
  """
  return date_based.archive_year(request, year = year, queryset =
Post.objects.published(), date_field = 'publish', make_object_list =
True)

###Template####

<div id="related-content">
  <h3>By month</h3>
  <ul class="related-list">
    {% for month in date_list %}
    <li><a href="{% url blog_index %}{{ year }}/{{ month|
date:"b" }}/">{{ month|date:"F" }}</a></li>
    {% endfor %}
  </ul>


On Sep 16, 11:39 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Tue, 2008-09-16 at 21:34 -0700, brian mckinney wrote:
> > Thanks for your reply Malcolm. I really appreciate all of your help.
>
> > Based on your advice, I did some testing and added some views that are
> > under my myapps directory and they immediately worked. Changing to a
> > view name in any other directory besides where my main app lives seems
> > to fail. This is something that was working prior to upgrading to
> > 1.0.
>
> > Are you sure that nothing has changed regarding how the reverse looks
> > up URLs due to this:http://code.djangoproject.com/changeset/8760
>
> Certainly stuff changed. A few hundred lines of it. However, none of the
> advertised functionality was meant to have changed. Since you haven't
> actually posted any examples, it's impossible to tell if what you're
> seeing is a bug or something that just worked by accident previously and
> wasn't intentional. There are, for example, some unpredictability if you
> are using a view name where the view is referred to as a reference to a
> Python function object (rather than a string) in the urlpatterns. But
> that was fragile before, too. It might be differently fragile now, I
> don't know. I also don't really care, since it's basically impossible to
> guarantee it will work correctly (which is why none of the documentation
> for reverse() and url tags use examples that are function references;
> only string view names or "name=..." names).
>
> All that aside, in the interests of moving forwards the easiest way to
> get around this hurdlewould be to use the url(....., name="foo") form of
> URL patterns. Coming up with unique, short names is easy and leads to
> much shorter url tags and patterns. Then your view names aren't
> susceptible to import paths or anything. You can call them things like
> "blog-entry" and it will never change.
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to