Refactoring
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 13 May 2013 09:30:24 +0000 (11:30 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 13 May 2013 09:30:24 +0000 (11:30 +0200)
apps/libraries/models.py
apps/libraries/templates/libraries/catalog_view.html [new file with mode: 0644]
apps/libraries/templates/libraries/library_view.html [deleted file]
apps/libraries/urls.py
apps/libraries/views.py

index 1ed43ad..c6db612 100644 (file)
@@ -17,7 +17,7 @@ class Catalog(models.Model):
         \r
     @models.permalink\r
     def get_absolute_url(self):\r
-        return ('library_view', [self.slug])\r
+        return ('libraries_catalog_view', [self.slug])\r
         \r
         \r
 class Library(models.Model):\r
diff --git a/apps/libraries/templates/libraries/catalog_view.html b/apps/libraries/templates/libraries/catalog_view.html
new file mode 100644 (file)
index 0000000..b109fa1
--- /dev/null
@@ -0,0 +1,22 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block titleextra %}{% trans 'Libraries directory' %}{% endblock %}
+
+
+{% block body %}
+    <h1>{% trans 'Libraries directory' %}: {{ catalog.name }}</h1>
+
+    <div class="libraries-list">
+        {% for library in catalog.libraries.all %}
+        <div class="libraries-list-item">
+            <div class="libraries-list-item-header"><a href="{{library.url}}">{{library.name}}</a></div>
+            <div class="libraries-list-item-description">
+                
+                {% autoescape off %}{{library.description}}{% endautoescape%}
+            </div>
+        </div>
+        {% endfor %}
+    </div>
+
+{% endblock %}
\ No newline at end of file
diff --git a/apps/libraries/templates/libraries/library_view.html b/apps/libraries/templates/libraries/library_view.html
deleted file mode 100644 (file)
index b109fa1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-{% extends "base.html" %}
-{% load i18n %}
-
-{% block titleextra %}{% trans 'Libraries directory' %}{% endblock %}
-
-
-{% block body %}
-    <h1>{% trans 'Libraries directory' %}: {{ catalog.name }}</h1>
-
-    <div class="libraries-list">
-        {% for library in catalog.libraries.all %}
-        <div class="libraries-list-item">
-            <div class="libraries-list-item-header"><a href="{{library.url}}">{{library.name}}</a></div>
-            <div class="libraries-list-item-description">
-                
-                {% autoescape off %}{{library.description}}{% endautoescape%}
-            </div>
-        </div>
-        {% endfor %}
-    </div>
-
-{% endblock %}
\ No newline at end of file
index 9262114..fe0fd6b 100644 (file)
@@ -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<slug>[a-zA-Z0-9_-]+)$', 'library_view', name='library_view'),
+    url(r'^/(?P<slug>[a-zA-Z0-9_-]+)$', 'catalog_view', name='libraries_catalog_view'),
 )
\ No newline at end of file
index baf7baa..88f993d 100644 (file)
@@ -9,7 +9,7 @@ def main_view(request):
     context['catalogs'] = Catalog.objects.all()\r
     return render_to_response('libraries/main_view.html', context_instance = context)\r
 \r
-def library_view(request, slug):\r
+def catalog_view(request, slug):\r
     context = RequestContext(request)\r
     context['catalog'] = get_object_or_404(Catalog.objects.filter(slug = slug).select_related())\r
-    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