On Sep 8, 4:37 pm, [EMAIL PROTECTED] wrote:
> Hey all,
>
> I have this code:
>
> http://dpaste.com/76671/
>
> When I go to the URL it doesn't display the page, but it also doesn't
> display and errors with the URL. What is wrong with the permalink
> instance?
>
> Also, is there a workaround for using multiple date based generic
> views and having them with different models? Say for a news one and
> then for an events one?
You probably won't get the reverse lookup to work on a generic view
without giving it a specific name in the URLconf. Note both the 'url'
before the expression and the name parameter at the end:
url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-
\w]+)/$', 'django.views.generic.date_based.object_detail', info_dict,
name='my_date_view'),
Then, in the permalink function, assuming your model does indeed have
a 'created' field:
@models.permalink
def get_absolute_url(self):
return ('my_date_view', (), {
'year': self.created.year,
'month': self.created.month,
'day': self.created.day,
'slug: self.slug})
--
DR
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---