diff options
author | luxagraf <sng@luxagraf.net> | 2013-04-23 23:27:02 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2013-04-23 23:27:02 -0400 |
commit | 7d2e5948b202973efa69fc30859ddbe0ff9b00b1 (patch) | |
tree | 6903d35a44e00b00ae6c80f304224d30cebbd283 | |
parent | d1f208f49265bef5b5eda5e4944696ccc4bdac1b (diff) |
fixed bug in details views
-rw-r--r-- | app/links/detail_urls.py | 11 | ||||
-rw-r--r-- | app/photos/detail_urls.py | 8 |
2 files changed, 11 insertions, 8 deletions
diff --git a/app/links/detail_urls.py b/app/links/detail_urls.py index 2b6ec5d..b629f3e 100644 --- a/app/links/detail_urls.py +++ b/app/links/detail_urls.py @@ -1,13 +1,14 @@ -from django.conf.urls.defaults import * -from django.views.generic.simple import redirect_to +from django.conf.urls import * +from django.views.generic.base import RedirectView +from django.views.generic.detail import DetailView from links.models import Link detail_dict = { 'queryset': Link.objects.filter(status__exact=1), } -urlpatterns = patterns('django.views.generic.list_detail', - (r'^$', redirect_to, {'url': '/links/1/'}), - (r'^(?P<object_id>\d+)/$', 'object_detail', dict(detail_dict, template_name='details/link.html')), +urlpatterns = patterns('', + (r'^$', RedirectView.as_view(url="/links/1/")), + (r'^(?P<object_id>\d+)/$', DetailView.as_view(model=Link,template_name='details/link.html')), ) diff --git a/app/photos/detail_urls.py b/app/photos/detail_urls.py index 9ff9b84..3acd139 100644 --- a/app/photos/detail_urls.py +++ b/app/photos/detail_urls.py @@ -1,10 +1,12 @@ -from django.conf.urls.defaults import * +from django.conf.urls import * +from django.views.generic.base import RedirectView +from django.views.generic.detail import DetailView from photos.models import Photo detail_dict = { 'queryset': Photo.objects.all(), } -urlpatterns = patterns('django.views.generic.list_detail', - (r'^(?P<object_id>\d+)/$', 'object_detail', dict(detail_dict, template_name='details/photo.html')), +urlpatterns = patterns('', + (r'^(?P<object_id>\d+)/$', DetailView.as_view(model=Photos,template_name='details/photo.html')), ) |