From bc7619edc01175ed32c2155a19fba22ddb8365ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Mon, 6 May 2013 15:48:29 +0200 Subject: [PATCH] wip: a first shot at libraries catalog --- apps/libraries/__init__.py | 0 apps/libraries/admin.py | 6 +++ .../libraries/locale/pl/LC_MESSAGES/django.mo | Bin 0 -> 721 bytes .../libraries/locale/pl/LC_MESSAGES/django.po | 44 ++++++++++++++++++ apps/libraries/migrations/0001_initial.py | 36 ++++++++++++++ apps/libraries/migrations/__init__.py | 0 apps/libraries/models.py | 21 +++++++++ apps/libraries/static/libraries/libraries.css | 16 +++++++ .../templates/libraries/main_view.html | 22 +++++++++ apps/libraries/urls.py | 6 +++ apps/libraries/views.py | 11 +++++ wolnelektury/settings/__init__.py | 1 + wolnelektury/settings/static.py | 1 + wolnelektury/urls.py | 1 + 14 files changed, 165 insertions(+) create mode 100644 apps/libraries/__init__.py create mode 100644 apps/libraries/admin.py create mode 100644 apps/libraries/locale/pl/LC_MESSAGES/django.mo create mode 100644 apps/libraries/locale/pl/LC_MESSAGES/django.po create mode 100644 apps/libraries/migrations/0001_initial.py create mode 100644 apps/libraries/migrations/__init__.py create mode 100644 apps/libraries/models.py create mode 100644 apps/libraries/static/libraries/libraries.css create mode 100644 apps/libraries/templates/libraries/main_view.html create mode 100644 apps/libraries/urls.py create mode 100644 apps/libraries/views.py diff --git a/apps/libraries/__init__.py b/apps/libraries/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/apps/libraries/admin.py b/apps/libraries/admin.py new file mode 100644 index 000000000..c43dd6a35 --- /dev/null +++ b/apps/libraries/admin.py @@ -0,0 +1,6 @@ +from django.contrib import admin + +from libraries.models import Library + + +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 index 0000000000000000000000000000000000000000..d8c29f1b0abfa5066bd94b07e32a71446002f600 GIT binary patch literal 721 zcmYL`F>ezw6vqt|5XS_p3|^>ORW81?Mb#x&dL)+;^)88$OC{Kx#61ib`(!&nP(K1I z3p*PN8%XR-{QxX1j4TX%0G_XbJn5(Zd-ng`d)EE9z4i`4TnFv~8E_ML3%K|U+yTA- z?))6M0elBs&re_t_yt@6eghvaA@m3I7V!S^#r;Q659&`#{R(;&>TjT~?;I4`s<^gP zC+^P8aRHWUmg_@_7;B~lH+U*EpID_AXv)n*i_!`uQStA7nJtiHGmhrEKz*&ALkH0WX!dBsIC1l1KC0kW2;G>-RF!)SS5yq{S=`aE}~mLd%rB0kaawH#G~AG3=;Mc&Vz|EN(}S>v*Vn7G5$?Kl!yVIxPx0AVb?!WL p6MB5;scqIhbj&O(RF21DTnJ_P3#3Y6(En1bQU?F_%_~;@+`lHZwkQAq literal 0 HcmV?d00001 diff --git a/apps/libraries/locale/pl/LC_MESSAGES/django.po b/apps/libraries/locale/pl/LC_MESSAGES/django.po new file mode 100644 index 000000000..57653b8fd --- /dev/null +++ b/apps/libraries/locale/pl/LC_MESSAGES/django.po @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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 index 000000000..0411c878a --- /dev/null +++ b/apps/libraries/migrations/0001_initial.py @@ -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 index 000000000..e69de29bb diff --git a/apps/libraries/models.py b/apps/libraries/models.py new file mode 100644 index 000000000..d8a54a8a5 --- /dev/null +++ b/apps/libraries/models.py @@ -0,0 +1,21 @@ +from django.db import models +from django.utils.translation import ugettext_lazy as _ + +class Library(models.Model): + """Represent a single library in the libraries dictionary""" + + #slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True) + name = models.CharField(_('name'), max_length=120, blank=True) + url = models.CharField(_('url'), max_length=120, blank=True) + description = models.TextField(_('description'), blank=True) + + class Meta: + verbose_name = _('library') + verbose_name_plural = _('libraries') + + def __unicode__(self): + return self.name + + @models.permalink + def get_absolute_url(self): + return ('infopage', [self.slug]) diff --git a/apps/libraries/static/libraries/libraries.css b/apps/libraries/static/libraries/libraries.css new file mode 100644 index 000000000..963e3badc --- /dev/null +++ b/apps/libraries/static/libraries/libraries.css @@ -0,0 +1,16 @@ +.libraries-list { + margin: 10px 0; +} + +.libraries-list-item { + margin: 10px 0; +} + +.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 index 000000000..9e16b1911 --- /dev/null +++ b/apps/libraries/templates/libraries/main_view.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block titleextra %}{% trans 'Libraries directory' %}{% endblock %} + + +{% block body %} +

{% trans 'Libraries directory' %}

+ +
+ {% for library in libraries %} +
+ +
+ + {% autoescape off %}{{library.description}}{% endautoescape%} +
+
+ {% endfor %} +
+ +{% endblock %} \ No newline at end of file diff --git a/apps/libraries/urls.py b/apps/libraries/urls.py new file mode 100644 index 000000000..a3d90316b --- /dev/null +++ b/apps/libraries/urls.py @@ -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 index 000000000..d75c8b468 --- /dev/null +++ b/apps/libraries/views.py @@ -0,0 +1,11 @@ +from django.shortcuts import render_to_response, get_object_or_404 +from django.template import RequestContext, Template, TemplateSyntaxError + +from libraries.models import Library + + +def main_view(request): + context = RequestContext(request) + context['libraries'] = Library.objects.all() + + return render_to_response('libraries/main_view.html', context_instance = context) \ No newline at end of file diff --git a/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index 8fdb97399..e5c7ece10 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -67,6 +67,7 @@ INSTALLED_APPS_OUR = [ 'waiter', 'search', 'oai', + 'libraries', ] INSTALLED_APPS_CONTRIB = [ diff --git a/wolnelektury/settings/static.py b/wolnelektury/settings/static.py index 4e104c4e7..aaa70c645 100644 --- a/wolnelektury/settings/static.py +++ b/wolnelektury/settings/static.py @@ -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', diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index 7224b20ed..980173371 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -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'), -- 2.20.1