Thank you for reply, but I still get the errror
Template error

In template .../weblog/templates/blog/article_archive.html, error at
line 6

Caught ViewDoesNotExist while rendering: Tried archive_day in module
django.views.generic.dates. Error was: 'module' object has no
attribute 'archive_day'
1       {% extends "blog/index.html" %}
2
3       {% block column1 %}
4       <h2>Archive</h2>
5       <ul>
6       {% for article in object_list %}
7       <li><h3><a
href="{{ article.get_absolute_url }}">{{ article.title }}
</a></h3>
8       Posted by {{ article.author }} on {{ article.pub_date|date:"F
jS,
Y" }}
9       </li>
10      {% endfor %}
11      </ul>
12      {% endblock %}
13      {% block column2 %}Last article here{% endblock %}

Could you please give an example about how to use get_absolute_url
with class based generic views?

On Oct 14, 1:31 pm, Fabrizio Mancini <mr.f...@gmail.com> wrote:
> On 13 October 2011 23:57, Andriyko <ahryts...@gmail.com> wrote:
>
> > urlpatterns = patterns('django.views.generic.dates',
> > (r'^(?P<year>\d{4})/v/(?P<day>\d{2})/(?P<slug>[-\w]+)/
> > $', DateDetailView.as_view(template_name='blog/article_detail.html',
> > **entry_info_dict)),
> > )
>
> Hi,
> You are using
> (?P<month>\w{3})
> but in get_absolute_url you are using
> self.pub_date.strftime("%m").lower(),
> referring tohttp://docs.python.org/library/time.html#time.strftime
> %m return Month as a decimal number [01,12].
> this won't never work
> You should use %b instead of %m
> This should work
> HTH
> Fabrizio
>
>
>
>
>
>
>
> > ===== models.py ====
>
> > class Article(models.Model):
> >    ......
> >   # with django 1.2 was
> >       @models.permalink
> >    def get_absolute_url(self):
> >        return ('article_detail', (), {  'year':
> > self.pub_date.strftime("%Y"),
> >                                         'month':
> > self.pub_date.strftime("%m").lower(),
> >                                         'day':
> > self.pub_date.strftime("%d"),
> >                                         'slug': self.slug })
> >   # how should it look with django 1.3 ??????

-- 
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.

Reply via email to