\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
--- /dev/null
+{% 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
+++ /dev/null
-{% 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
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
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