wip: a first shot at libraries catalog
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 6 May 2013 13:48:29 +0000 (15:48 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Mon, 6 May 2013 13:48:29 +0000 (15:48 +0200)
14 files changed:
apps/libraries/__init__.py [new file with mode: 0644]
apps/libraries/admin.py [new file with mode: 0644]
apps/libraries/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
apps/libraries/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
apps/libraries/migrations/0001_initial.py [new file with mode: 0644]
apps/libraries/migrations/__init__.py [new file with mode: 0644]
apps/libraries/models.py [new file with mode: 0644]
apps/libraries/static/libraries/libraries.css [new file with mode: 0644]
apps/libraries/templates/libraries/main_view.html [new file with mode: 0644]
apps/libraries/urls.py [new file with mode: 0644]
apps/libraries/views.py [new file with mode: 0644]
wolnelektury/settings/__init__.py
wolnelektury/settings/static.py
wolnelektury/urls.py

diff --git a/apps/libraries/__init__.py b/apps/libraries/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/libraries/admin.py b/apps/libraries/admin.py
new file mode 100644 (file)
index 0000000..c43dd6a
--- /dev/null
@@ -0,0 +1,6 @@
+from django.contrib import admin\r
+\r
+from libraries.models import Library\r
+\r
+\r
+admin.site.register(Library)
\ No newline at end of file
diff --git a/apps/libraries/locale/pl/LC_MESSAGES/django.mo b/apps/libraries/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..d8c29f1
Binary files /dev/null and b/apps/libraries/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/apps/libraries/locale/pl/LC_MESSAGES/django.po b/apps/libraries/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..57653b8
--- /dev/null
@@ -0,0 +1,44 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-05-06 15:42+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+
+#: models.py:8
+msgid "name"
+msgstr "nazwa"
+
+#: models.py:9
+msgid "url"
+msgstr "url"
+
+#: models.py:10
+msgid "description"
+msgstr "opis"
+
+#: models.py:13
+msgid "library"
+msgstr "biblioteka"
+
+#: models.py:14
+msgid "libraries"
+msgstr "biblioteki"
+
+#: templates/libraries/main_view.html:4 templates/libraries/main_view.html:8
+msgid "Libraries directory"
+msgstr "Katalog bibliotek"
diff --git a/apps/libraries/migrations/0001_initial.py b/apps/libraries/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..0411c87
--- /dev/null
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Library'
+        db.create_table(u'libraries_library', (
+            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)),
+            ('url', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)),
+            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
+        ))
+        db.send_create_signal(u'libraries', ['Library'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Library'
+        db.delete_table(u'libraries_library')
+
+
+    models = {
+        u'libraries.library': {
+            'Meta': {'object_name': 'Library'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}),
+            'url': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['libraries']
\ No newline at end of file
diff --git a/apps/libraries/migrations/__init__.py b/apps/libraries/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/libraries/models.py b/apps/libraries/models.py
new file mode 100644 (file)
index 0000000..d8a54a8
--- /dev/null
@@ -0,0 +1,21 @@
+from django.db import models\r
+from django.utils.translation import ugettext_lazy as _\r
+\r
+class Library(models.Model):\r
+    """Represent a single library in the libraries dictionary"""\r
+\r
+    #slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True)\r
+    name = models.CharField(_('name'), max_length=120, blank=True)
+    url = models.CharField(_('url'), max_length=120, blank=True)
+    description = models.TextField(_('description'), blank=True)\r
+\r
+    class Meta:\r
+        verbose_name = _('library')\r
+        verbose_name_plural = _('libraries')\r
+\r
+    def __unicode__(self):\r
+        return self.name\r
+\r
+    @models.permalink\r
+    def get_absolute_url(self):\r
+        return ('infopage', [self.slug])\r
diff --git a/apps/libraries/static/libraries/libraries.css b/apps/libraries/static/libraries/libraries.css
new file mode 100644 (file)
index 0000000..963e3ba
--- /dev/null
@@ -0,0 +1,16 @@
+.libraries-list {\r
+    margin: 10px 0;\r
+}\r
+\r
+.libraries-list-item {\r
+    margin: 10px 0;\r
+}
+
+.libraries-list-item {
+    margin: 10px 0;
+    font-size: 1.3em;
+}
+
+.libraries-list-item-header {
+    font-size: 1.2em;
+}
\ No newline at end of file
diff --git a/apps/libraries/templates/libraries/main_view.html b/apps/libraries/templates/libraries/main_view.html
new file mode 100644 (file)
index 0000000..9e16b19
--- /dev/null
@@ -0,0 +1,22 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block titleextra %}{% trans 'Libraries directory' %}{% endblock %}
+
+
+{% block body %}
+    <h1>{% trans 'Libraries directory' %}</h1>
+
+    <div class="libraries-list">
+        {% for library in libraries %}
+        <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/urls.py b/apps/libraries/urls.py
new file mode 100644 (file)
index 0000000..a3d9031
--- /dev/null
@@ -0,0 +1,6 @@
+from django.conf.urls.defaults import *
+
+
+urlpatterns = patterns('libraries.views',
+    url(r'^$', 'main_view', name='libraries_main_view'),
+)
\ No newline at end of file
diff --git a/apps/libraries/views.py b/apps/libraries/views.py
new file mode 100644 (file)
index 0000000..d75c8b4
--- /dev/null
@@ -0,0 +1,11 @@
+from django.shortcuts import render_to_response, get_object_or_404\r
+from django.template import RequestContext, Template, TemplateSyntaxError\r
+\r
+from libraries.models import Library\r
+\r
+\r
+def main_view(request):\r
+    context = RequestContext(request)
+    context['libraries'] = Library.objects.all()\r
+\r
+    return render_to_response('libraries/main_view.html', context_instance = context)
\ No newline at end of file
index 8fdb973..e5c7ece 100644 (file)
@@ -67,6 +67,7 @@ INSTALLED_APPS_OUR = [
     'waiter',
     'search',
     'oai',
+    'libraries',
     ]
 
 INSTALLED_APPS_CONTRIB = [
index 4e104c4..aaa70c6 100644 (file)
@@ -30,6 +30,7 @@ PIPELINE_CSS = {
             'css/catalogue.css',
             'sponsors/css/sponsors.css',
             'css/auth.css',
+            'libraries/libraries.css',
 
             'css/social/shelf_tags.css',
             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
index 7224b20..9801733 100644 (file)
@@ -35,6 +35,7 @@ urlpatterns += patterns('',
     url(r'^ludzie/', include('social.urls')),
     url(r'^uzytkownik/', include('allauth.urls')),
     url(r'^czekaj/', include('waiter.urls')),
+    url(r'^biblioteki/', include('libraries.urls')),
 
     # Admin panel
     url(r'^admin/catalogue/book/import$', 'catalogue.views.import_book', name='import_book'),