From 23f0993732ac597e0a4ab1330b62b970c09d476c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 13 May 2013 11:30:24 +0200 Subject: [PATCH] Refactoring --- apps/libraries/models.py | 2 +- .../libraries/{library_view.html => catalog_view.html} | 0 apps/libraries/urls.py | 2 +- apps/libraries/views.py | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) rename apps/libraries/templates/libraries/{library_view.html => catalog_view.html} (100%) diff --git a/apps/libraries/models.py b/apps/libraries/models.py index 1ed43ad77..c6db612b9 100644 --- a/apps/libraries/models.py +++ b/apps/libraries/models.py @@ -17,7 +17,7 @@ class Catalog(models.Model): @models.permalink def get_absolute_url(self): - return ('library_view', [self.slug]) + return ('libraries_catalog_view', [self.slug]) class Library(models.Model): diff --git a/apps/libraries/templates/libraries/library_view.html b/apps/libraries/templates/libraries/catalog_view.html similarity index 100% rename from apps/libraries/templates/libraries/library_view.html rename to apps/libraries/templates/libraries/catalog_view.html diff --git a/apps/libraries/urls.py b/apps/libraries/urls.py index 92621144b..fe0fd6b96 100644 --- a/apps/libraries/urls.py +++ b/apps/libraries/urls.py @@ -5,5 +5,5 @@ from django.http import HttpResponseRedirect urlpatterns = patterns('libraries.views', url(r'^$', 'main_view', name='libraries_main_view'), url(r'^/$', lambda x: HttpResponseRedirect(x.path[:-1])), - url(r'^/(?P[a-zA-Z0-9_-]+)$', 'library_view', name='library_view'), + url(r'^/(?P[a-zA-Z0-9_-]+)$', 'catalog_view', name='libraries_catalog_view'), ) \ No newline at end of file diff --git a/apps/libraries/views.py b/apps/libraries/views.py index baf7baaf4..88f993d68 100644 --- a/apps/libraries/views.py +++ b/apps/libraries/views.py @@ -9,7 +9,7 @@ def main_view(request): context['catalogs'] = Catalog.objects.all() return render_to_response('libraries/main_view.html', context_instance = context) -def library_view(request, slug): +def catalog_view(request, slug): context = RequestContext(request) context['catalog'] = get_object_or_404(Catalog.objects.filter(slug = slug).select_related()) - return render_to_response('libraries/library_view.html', context_instance = context) \ No newline at end of file + return render_to_response('libraries/catalog_view.html', context_instance = context) \ No newline at end of file -- 2.20.1