From 0bd2c341a8b55f817c2e193a6c4658d52ef95961 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 13 Feb 2014 12:22:12 +0100 Subject: [PATCH] Django 1.6 and some cleaning. Using django-piwik in place of old `piwik` app, moved django-modeltranslation out of bundled apps, fixed translation2po command, removed some unused files (to be continued!), updated bundled software info. --- README.md | 96 ++-- apps/api/handlers.py | 4 +- ...e_de__chg_field_collection_description_.py | 447 ++++++++++++++++++ apps/catalogue/models/book.py | 2 - .../templates/catalogue/viewer_base.html | 2 +- ...nk_content__chg_field_chunk_description.py | 49 ++ ...r__chg_field_chunk_content_ru__chg_fiel.py | 91 ++++ apps/chunks/models.py | 4 +- ...de__chg_field_infopage_left_column_uk__.py | 215 +++++++++ apps/modeltranslation/__init__.py | 0 apps/modeltranslation/admin.py | 140 ------ apps/modeltranslation/fields.py | 111 ----- apps/modeltranslation/management/__init__.py | 0 .../management/commands/__init__.py | 0 .../commands/update_translation_fields.py | 38 -- apps/modeltranslation/models.py | 44 -- apps/modeltranslation/tests.py | 258 ---------- apps/modeltranslation/testurls.py | 7 - apps/modeltranslation/translator.py | 191 -------- apps/modeltranslation/utils.py | 123 ----- apps/stats/utils.py | 12 +- apps/suggest/forms.py | 6 +- .../management/commands/localepack.py | 2 +- .../management/commands/translation2po.py | 48 +- .../wolnelektury_core/static/fonts/WL-Nav.eot | Bin 2952 -> 0 bytes .../wolnelektury_core/static/fonts/WL-Nav.ttf | Bin 2764 -> 0 bytes apps/wolnelektury_core/static/fonts/WL.eot | Bin 5300 -> 0 bytes apps/wolnelektury_core/static/fonts/WL.ttf | Bin 5248 -> 0 bytes apps/wolnelektury_core/static/js/annoy.js | 0 apps/wolnelektury_core/static/js/base.js | 0 .../static/js/{ => contrib}/ierange-m2.js | 0 .../jquery-ui-1.8.16.custom.min.js | 0 .../js/{ => contrib}/jquery.autocomplete.js | 0 .../js/{ => contrib}/jquery.countdown-de.js | 0 .../js/{ => contrib}/jquery.countdown-es.js | 0 .../js/{ => contrib}/jquery.countdown-fr.js | 0 .../js/{ => contrib}/jquery.countdown-lt.js | 0 .../js/{ => contrib}/jquery.countdown-pl.js | 0 .../js/{ => contrib}/jquery.countdown-ru.js | 0 .../js/{ => contrib}/jquery.countdown-uk.js | 0 .../js/{ => contrib}/jquery.countdown.js | 0 .../js/{ => contrib}/jquery.cycle.min.js | 0 .../{ => contrib}/jquery.eventdelegation.js | 0 .../static/js/{ => contrib}/jquery.form.js | 0 .../js/{ => contrib}/jquery.highlightfade.js | 0 .../static/js/{ => contrib}/jquery.jqmodal.js | 0 .../static/js/{ => contrib}/jquery.js | 0 .../js/{ => contrib}/jquery.scrollto.js | 0 .../{ => contrib}/modernizr.custom.19652.js | 0 .../static/js/contrib/progressSpin.min.js | 1 + .../static/js/{ => contrib}/raphael-min.js | 0 apps/wolnelektury_core/static/js/dialogs.js | 0 .../static/js/jquery-ui-1.8.2.custom.min.js | 75 --- apps/wolnelektury_core/static/js/locale.js | 0 .../static/js/ordered_select_multiple.js | 63 --- .../static/js/progressSpin.min.js | 1 - .../templates/superbase.html | 5 +- requirements.txt | 5 +- wolnelektury/settings/__init__.py | 3 +- wolnelektury/settings/contrib.py | 9 +- wolnelektury/settings/static.py | 38 +- wolnelektury/urls.py | 2 +- 62 files changed, 900 insertions(+), 1192 deletions(-) create mode 100644 apps/catalogue/migrations/0016_auto__chg_field_collection_title_de__chg_field_collection_description_.py create mode 100644 apps/chunks/migrations/0003_auto__chg_field_chunk_content__chg_field_chunk_description.py create mode 100644 apps/chunks/migrations/0004_auto__chg_field_chunk_content_fr__chg_field_chunk_content_ru__chg_fiel.py create mode 100644 apps/infopages/migrations/0005_auto__chg_field_infopage_title_de__chg_field_infopage_left_column_uk__.py delete mode 100644 apps/modeltranslation/__init__.py delete mode 100644 apps/modeltranslation/admin.py delete mode 100644 apps/modeltranslation/fields.py delete mode 100644 apps/modeltranslation/management/__init__.py delete mode 100644 apps/modeltranslation/management/commands/__init__.py delete mode 100644 apps/modeltranslation/management/commands/update_translation_fields.py delete mode 100644 apps/modeltranslation/models.py delete mode 100644 apps/modeltranslation/tests.py delete mode 100644 apps/modeltranslation/testurls.py delete mode 100644 apps/modeltranslation/translator.py delete mode 100644 apps/modeltranslation/utils.py rename apps/{modeltranslation => wolnelektury_core}/management/commands/translation2po.py (78%) delete mode 100644 apps/wolnelektury_core/static/fonts/WL-Nav.eot delete mode 100644 apps/wolnelektury_core/static/fonts/WL-Nav.ttf delete mode 100644 apps/wolnelektury_core/static/fonts/WL.eot delete mode 100644 apps/wolnelektury_core/static/fonts/WL.ttf mode change 100755 => 100644 apps/wolnelektury_core/static/js/annoy.js mode change 100755 => 100644 apps/wolnelektury_core/static/js/base.js rename apps/wolnelektury_core/static/js/{ => contrib}/ierange-m2.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery-ui-1.8.16.custom.min.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.autocomplete.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-de.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-es.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-fr.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-lt.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-pl.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-ru.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown-uk.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.countdown.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.cycle.min.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.eventdelegation.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.form.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.highlightfade.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.jqmodal.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/jquery.scrollto.js (100%) rename apps/wolnelektury_core/static/js/{ => contrib}/modernizr.custom.19652.js (100%) create mode 100644 apps/wolnelektury_core/static/js/contrib/progressSpin.min.js rename apps/wolnelektury_core/static/js/{ => contrib}/raphael-min.js (100%) mode change 100755 => 100644 apps/wolnelektury_core/static/js/dialogs.js delete mode 100644 apps/wolnelektury_core/static/js/jquery-ui-1.8.2.custom.min.js mode change 100755 => 100644 apps/wolnelektury_core/static/js/locale.js delete mode 100644 apps/wolnelektury_core/static/js/ordered_select_multiple.js delete mode 100644 apps/wolnelektury_core/static/js/progressSpin.min.js diff --git a/README.md b/README.md index e9999ed37..863593e97 100644 --- a/README.md +++ b/README.md @@ -56,77 +56,35 @@ How to deploy (development version) Translation strings are based on gettext and can be found under 'locale' dir. There are also JavaScript files for jQuery countdown plugin (static/js/jquery.countdown-*.js). -Full list of used open-source software -====================================== - -External --------- - -django --------- - - Source: [djangoproject.com](http://www.djangoproject.com/) - - Authors: [many authors](http://code.djangoproject.com/browser/django/trunk/AUTHORS) - - License: [BSD License](http://code.djangoproject.com/browser/django/trunk/LICENSE) - - Type: framework - -django-pagination ------------------ - - Source: [Google Code](http://code.google.com/p/django-pagination/) - - Authors: James Tauber , leidel@gmail.com - - License: [New BSD License](http://www.opensource.org/licenses/bsd-license.php) - - Type: library (django application) - -django-rosetta ------------------ - - Source: [Google Code](http://code.google.com/p/django-rosetta/) - - Authors: James Tauber , leidel@gmail.com - - License: [MIT License](http://www.opensource.org/licenses/mit-license.php) - - Type: library (django application) - - -Django South ------------- -- Source: [aercode.org](http://south.aeracode.org/) -- Authors: Andrew Godwin , Andy McCurdy -- License: [Apache License 2.0](http://www.opensource.org/licenses/apache2.0.php) -- Type: library (django application) - -lxml ---------- - - Source: [codespeak.net](http://codespeak.net/lxml/index.html#download) - - Authors: [many authors](http://codespeak.net/lxml/credits.html) - - License: [BSD License](http://codespeak.net/lxml/index.html#license) - - Type: library - -feedparser ----------- - - Source: [Google Code](http://code.google.com/p/feedparser/) - - Authors: Mark Pilgrim - - License: [MIT License](http://www.opensource.org/licenses/mit-license.php) - - Type: library - - -Internal (means we hacked on sources of those): ---------- - -django-chunks -------------- - - Source: [Google Code](http://code.google.com/p/django-chunks/) - - Authors: Clint Ecker - - License: [New BSD License](http://www.opensource.org/licenses/bsd-license.php) - - Type: library (Django application) - -django-newtagging ------------------ - - Source: [BitBucket](http://www.bitbucket.org/zuber/django-newtagging/) - - Authors: Marek Stępniowski - - License: [MIT License](http://www.opensource.org/licenses/mit-license.php) - - Type: library (Django aplication) - - Notes: Aplication based on [django-tagging](http://code.google.com/p/django-tagging/), also [MIT](http://www.opensource.org/licenses/mit-license.php) license. - +Bundled software +================ + +* django-chunks + in `apps/chunks` + based on [django-chunks](http://code.google.com/p/django-chunks/) + by Clint Ecker , + [New BSD License](http://www.opensource.org/licenses/bsd-license.php) +* [django-newtagging](http://www.bitbucket.org/zuber/django-newtagging/) + in `apps/newtagging` + by Marek Stępniowski , + [MIT License](http://www.opensource.org/licenses/mit-license.php), + based on [django-tagging](http://code.google.com/p/django-tagging/), also under [MIT License](http://www.opensource.org/licenses/mit-license.php) +* [jPlayer](http://jplayer.org/) + in `apps/catalogue/static/jplayer` + by Happyworm, + [MIT License](http://opensource.org/licenses/MIT) +* [Switch template tag](http://djangosnippets.org/snippets/967/) + in `apps/wolnelektury_core/templatetags/switch_tag.py` + by adurdin +* [Cropping engine for sorl-thumbnail](http://timmyomahony.com/blog/custom-cropping-engine-sorl-thumbnail/) + in `apps/picture/engine.py` + by Timmy O'Mahony +* Javascript in `apps/wolnelektury_core/static/js/contrib` + with relevant attribution and licensing + + Authors ======= - * Marek Stępniowski * Łukasz Rekucki diff --git a/apps/api/handlers.py b/apps/api/handlers.py index c118d95df..89c726f8c 100644 --- a/apps/api/handlers.py +++ b/apps/api/handlers.py @@ -10,6 +10,7 @@ from django.conf import settings from django.contrib.sites.models import Site from django.core.cache import get_cache from django.core.urlresolvers import reverse +from django.utils.functional import lazy from django.utils.timezone import utc from piston.handler import AnonymousBaseHandler, BaseHandler from piston.utils import rc @@ -26,7 +27,8 @@ from wolnelektury.utils import tz from stats.utils import piwik_track -API_BASE = WL_BASE = MEDIA_BASE = 'http://' + Site.objects.get_current().domain +API_BASE = WL_BASE = MEDIA_BASE = lazy( + lambda: u'http://' + Site.objects.get_current().domain, unicode)() category_singular = { diff --git a/apps/catalogue/migrations/0016_auto__chg_field_collection_title_de__chg_field_collection_description_.py b/apps/catalogue/migrations/0016_auto__chg_field_collection_title_de__chg_field_collection_description_.py new file mode 100644 index 000000000..522df5661 --- /dev/null +++ b/apps/catalogue/migrations/0016_auto__chg_field_collection_title_de__chg_field_collection_description_.py @@ -0,0 +1,447 @@ +# -*- 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): + + # Changing field 'Collection.title_de' + db.alter_column(u'catalogue_collection', 'title_de', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_fr' + db.alter_column(u'catalogue_collection', 'description_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_de' + db.alter_column(u'catalogue_collection', 'description_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_uk' + db.alter_column(u'catalogue_collection', 'description_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_fr' + db.alter_column(u'catalogue_collection', 'title_fr', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_lt' + db.alter_column(u'catalogue_collection', 'description_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_lt' + db.alter_column(u'catalogue_collection', 'title_lt', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_pl' + db.alter_column(u'catalogue_collection', 'description_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_uk' + db.alter_column(u'catalogue_collection', 'title_uk', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_ru' + db.alter_column(u'catalogue_collection', 'description_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_en' + db.alter_column(u'catalogue_collection', 'title_en', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_en' + db.alter_column(u'catalogue_collection', 'description_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_es' + db.alter_column(u'catalogue_collection', 'title_es', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_es' + db.alter_column(u'catalogue_collection', 'description_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_it' + db.alter_column(u'catalogue_collection', 'description_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_pl' + db.alter_column(u'catalogue_collection', 'title_pl', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.title_ru' + db.alter_column(u'catalogue_collection', 'title_ru', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.title_it' + db.alter_column(u'catalogue_collection', 'title_it', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Tag.name_fr' + db.alter_column(u'catalogue_tag', 'name_fr', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_fr' + db.alter_column(u'catalogue_tag', 'wiki_link_fr', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_de' + db.alter_column(u'catalogue_tag', 'name_de', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_fr' + db.alter_column(u'catalogue_tag', 'description_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_de' + db.alter_column(u'catalogue_tag', 'description_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_uk' + db.alter_column(u'catalogue_tag', 'description_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_de' + db.alter_column(u'catalogue_tag', 'wiki_link_de', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_ru' + db.alter_column(u'catalogue_tag', 'name_ru', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_lt' + db.alter_column(u'catalogue_tag', 'description_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.name_it' + db.alter_column(u'catalogue_tag', 'name_it', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_it' + db.alter_column(u'catalogue_tag', 'wiki_link_it', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_pl' + db.alter_column(u'catalogue_tag', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_pl' + db.alter_column(u'catalogue_tag', 'description_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_pl' + db.alter_column(u'catalogue_tag', 'wiki_link_pl', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.wiki_link_ru' + db.alter_column(u'catalogue_tag', 'wiki_link_ru', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.description_ru' + db.alter_column(u'catalogue_tag', 'description_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_es' + db.alter_column(u'catalogue_tag', 'wiki_link_es', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_es' + db.alter_column(u'catalogue_tag', 'name_es', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_en' + db.alter_column(u'catalogue_tag', 'description_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_es' + db.alter_column(u'catalogue_tag', 'description_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_it' + db.alter_column(u'catalogue_tag', 'description_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.name_en' + db.alter_column(u'catalogue_tag', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_en' + db.alter_column(u'catalogue_tag', 'wiki_link_en', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.wiki_link_uk' + db.alter_column(u'catalogue_tag', 'wiki_link_uk', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_uk' + db.alter_column(u'catalogue_tag', 'name_uk', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_lt' + db.alter_column(u'catalogue_tag', 'wiki_link_lt', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_lt' + db.alter_column(u'catalogue_tag', 'name_lt', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + def backwards(self, orm): + + # Changing field 'Collection.title_de' + db.alter_column(u'catalogue_collection', 'title_de', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_fr' + db.alter_column(u'catalogue_collection', 'description_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_de' + db.alter_column(u'catalogue_collection', 'description_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_uk' + db.alter_column(u'catalogue_collection', 'description_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_fr' + db.alter_column(u'catalogue_collection', 'title_fr', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_lt' + db.alter_column(u'catalogue_collection', 'description_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_lt' + db.alter_column(u'catalogue_collection', 'title_lt', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_pl' + db.alter_column(u'catalogue_collection', 'description_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_uk' + db.alter_column(u'catalogue_collection', 'title_uk', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_ru' + db.alter_column(u'catalogue_collection', 'description_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_en' + db.alter_column(u'catalogue_collection', 'title_en', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_en' + db.alter_column(u'catalogue_collection', 'description_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_es' + db.alter_column(u'catalogue_collection', 'title_es', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.description_es' + db.alter_column(u'catalogue_collection', 'description_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.description_it' + db.alter_column(u'catalogue_collection', 'description_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Collection.title_pl' + db.alter_column(u'catalogue_collection', 'title_pl', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.title_ru' + db.alter_column(u'catalogue_collection', 'title_ru', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Collection.title_it' + db.alter_column(u'catalogue_collection', 'title_it', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'Tag.name_fr' + db.alter_column(u'catalogue_tag', 'name_fr', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_fr' + db.alter_column(u'catalogue_tag', 'wiki_link_fr', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_de' + db.alter_column(u'catalogue_tag', 'name_de', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_fr' + db.alter_column(u'catalogue_tag', 'description_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_de' + db.alter_column(u'catalogue_tag', 'description_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_uk' + db.alter_column(u'catalogue_tag', 'description_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_de' + db.alter_column(u'catalogue_tag', 'wiki_link_de', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_ru' + db.alter_column(u'catalogue_tag', 'name_ru', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_lt' + db.alter_column(u'catalogue_tag', 'description_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.name_it' + db.alter_column(u'catalogue_tag', 'name_it', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_it' + db.alter_column(u'catalogue_tag', 'wiki_link_it', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_pl' + db.alter_column(u'catalogue_tag', 'name_pl', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_pl' + db.alter_column(u'catalogue_tag', 'description_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_pl' + db.alter_column(u'catalogue_tag', 'wiki_link_pl', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.wiki_link_ru' + db.alter_column(u'catalogue_tag', 'wiki_link_ru', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.description_ru' + db.alter_column(u'catalogue_tag', 'description_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.wiki_link_es' + db.alter_column(u'catalogue_tag', 'wiki_link_es', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_es' + db.alter_column(u'catalogue_tag', 'name_es', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.description_en' + db.alter_column(u'catalogue_tag', 'description_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_es' + db.alter_column(u'catalogue_tag', 'description_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.description_it' + db.alter_column(u'catalogue_tag', 'description_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Tag.name_en' + db.alter_column(u'catalogue_tag', 'name_en', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_en' + db.alter_column(u'catalogue_tag', 'wiki_link_en', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.wiki_link_uk' + db.alter_column(u'catalogue_tag', 'wiki_link_uk', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_uk' + db.alter_column(u'catalogue_tag', 'name_uk', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + # Changing field 'Tag.wiki_link_lt' + db.alter_column(u'catalogue_tag', 'wiki_link_lt', self.gf('django.db.models.fields.CharField')(max_length=240, null=True)) + + # Changing field 'Tag.name_lt' + db.alter_column(u'catalogue_tag', 'name_lt', self.gf('django.db.models.fields.CharField')(max_length=50, null=True)) + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'catalogue.book': { + 'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'}, + '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}), + 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), + 'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}), + 'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}), + 'cover_thumb': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover_thumb'", 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}), + 'extra_info': ('jsonfield.fields.JSONField', [], {'default': '{}'}), + 'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}), + 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), + 'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}), + 'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), + 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}), + 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}), + 'sort_key_author': ('django.db.models.fields.CharField', [], {'default': "u''", 'max_length': '120', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), + 'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}), + 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), + 'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'}) + }, + 'catalogue.bookmedia': { + 'Meta': {'ordering': "('type', 'name')", 'object_name': 'BookMedia'}, + 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'media'", 'to': "orm['catalogue.Book']"}), + 'extra_info': ('jsonfield.fields.JSONField', [], {'default': '{}'}), + 'file': ('catalogue.fields.OverwritingFileField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '512'}), + 'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': "'100'", 'db_index': 'True'}), + 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}) + }, + 'catalogue.collection': { + 'Meta': {'ordering': "('title',)", 'object_name': 'Collection'}, + 'book_slugs': ('django.db.models.fields.TextField', [], {}), + 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_de': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_en': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_es': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_fr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_it': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_lt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_ru': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_uk': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'kind': ('django.db.models.fields.CharField', [], {'default': "'book'", 'max_length': '10', 'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'primary_key': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}), + 'title_de': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_en': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_es': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_fr': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_it': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_lt': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_pl': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_ru': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_uk': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '120', 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.fragment': { + 'Meta': {'ordering': "('book', 'anchor')", 'object_name': 'Fragment'}, + 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'short_text': ('django.db.models.fields.TextField', [], {}), + 'text': ('django.db.models.fields.TextField', [], {}) + }, + 'catalogue.tag': { + 'Meta': {'ordering': "('sort_key',)", 'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'}, + 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), + 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), + 'culturepl_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), + 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'description_de': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_en': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_es': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_fr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_it': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_lt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_pl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_ru': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description_uk': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), + 'name_de': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_en': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_es': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_fr': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_it': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_lt': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_pl': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_ru': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'name_uk': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '50', 'null': 'True', 'blank': 'True'}), + 'picture_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}), + 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), + 'wiki_link_de': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_en': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_es': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_fr': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_it': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_lt': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_pl': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_ru': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}), + 'wiki_link_uk': ('django.db.models.fields.CharField', [], {'max_length': '240', 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.tagrelation': { + 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "u'catalogue_tag_relation'"}, + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['catalogue'] \ No newline at end of file diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 83bc040c6..b9441c386 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -521,8 +521,6 @@ class Book(models.Model): rel_info = book.related_info() names = [(related_tag_name(tag), Tag.create_url('author', tag['slug'])) for tag in rel_info['tags'].get('author', ())] - import logging - logging.info("%s, %s" % (book.slug, unicode(rel_info['tags'].get('author', ())))) if 'parents' in rel_info: books = [(name, Book.create_url(slug)) for name, slug in rel_info['parents']] diff --git a/apps/catalogue/templates/catalogue/viewer_base.html b/apps/catalogue/templates/catalogue/viewer_base.html index dccd4e887..1b4a92b22 100644 --- a/apps/catalogue/templates/catalogue/viewer_base.html +++ b/apps/catalogue/templates/catalogue/viewer_base.html @@ -69,6 +69,6 @@ {{ piwik_tag|safe }} {% block extrabody %}{% endblock %} - + diff --git a/apps/chunks/migrations/0003_auto__chg_field_chunk_content__chg_field_chunk_description.py b/apps/chunks/migrations/0003_auto__chg_field_chunk_content__chg_field_chunk_description.py new file mode 100644 index 000000000..9137ad2ab --- /dev/null +++ b/apps/chunks/migrations/0003_auto__chg_field_chunk_content__chg_field_chunk_description.py @@ -0,0 +1,49 @@ +# -*- 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): + + # Changing field 'Chunk.content' + db.alter_column(u'chunks_chunk', 'content', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.description' + db.alter_column(u'chunks_chunk', 'description', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) + + def backwards(self, orm): + + # Changing field 'Chunk.content' + db.alter_column(u'chunks_chunk', 'content', self.gf('django.db.models.fields.TextField')(default='')) + + # Changing field 'Chunk.description' + db.alter_column(u'chunks_chunk', 'description', self.gf('django.db.models.fields.CharField')(default='', max_length=255)) + + models = { + u'chunks.attachment': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Attachment'}, + 'attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + }, + u'chunks.chunk': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Chunk'}, + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_it': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'content_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + } + } + + complete_apps = ['chunks'] \ No newline at end of file diff --git a/apps/chunks/migrations/0004_auto__chg_field_chunk_content_fr__chg_field_chunk_content_ru__chg_fiel.py b/apps/chunks/migrations/0004_auto__chg_field_chunk_content_fr__chg_field_chunk_content_ru__chg_fiel.py new file mode 100644 index 000000000..ffbae4be1 --- /dev/null +++ b/apps/chunks/migrations/0004_auto__chg_field_chunk_content_fr__chg_field_chunk_content_ru__chg_fiel.py @@ -0,0 +1,91 @@ +# -*- 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): + + # Changing field 'Chunk.content_fr' + db.alter_column(u'chunks_chunk', 'content_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_ru' + db.alter_column(u'chunks_chunk', 'content_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_es' + db.alter_column(u'chunks_chunk', 'content_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_it' + db.alter_column(u'chunks_chunk', 'content_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_uk' + db.alter_column(u'chunks_chunk', 'content_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_de' + db.alter_column(u'chunks_chunk', 'content_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_lt' + db.alter_column(u'chunks_chunk', 'content_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_pl' + db.alter_column(u'chunks_chunk', 'content_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_en' + db.alter_column(u'chunks_chunk', 'content_en', self.gf('django.db.models.fields.TextField')(null=True)) + + def backwards(self, orm): + + # Changing field 'Chunk.content_fr' + db.alter_column(u'chunks_chunk', 'content_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_ru' + db.alter_column(u'chunks_chunk', 'content_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_es' + db.alter_column(u'chunks_chunk', 'content_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_it' + db.alter_column(u'chunks_chunk', 'content_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_uk' + db.alter_column(u'chunks_chunk', 'content_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_de' + db.alter_column(u'chunks_chunk', 'content_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_lt' + db.alter_column(u'chunks_chunk', 'content_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_pl' + db.alter_column(u'chunks_chunk', 'content_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'Chunk.content_en' + db.alter_column(u'chunks_chunk', 'content_en', self.gf('django.db.models.fields.TextField')(null=True)) + + models = { + u'chunks.attachment': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Attachment'}, + 'attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + }, + u'chunks.chunk': { + 'Meta': {'ordering': "('key',)", 'object_name': 'Chunk'}, + 'content': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_de': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_en': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_es': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_fr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_it': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_lt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_pl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_ru': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'content_uk': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'description': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'key': ('django.db.models.fields.CharField', [], {'max_length': '255', 'primary_key': 'True'}) + } + } + + complete_apps = ['chunks'] \ No newline at end of file diff --git a/apps/chunks/models.py b/apps/chunks/models.py index 4ab846b3a..5cdf8fea8 100644 --- a/apps/chunks/models.py +++ b/apps/chunks/models.py @@ -9,8 +9,8 @@ class Chunk(models.Model): any template with the use of a special template tag. """ key = models.CharField(_('key'), help_text=_('A unique name for this chunk of content'), primary_key=True, max_length=255) - description = models.CharField(_('description'), blank=True, max_length=255) - content = models.TextField(_('content'), blank=True) + description = models.CharField(_('description'), blank=True, null=True, max_length=255) + content = models.TextField(_('content'), blank=True, null=True) class Meta: ordering = ('key',) diff --git a/apps/infopages/migrations/0005_auto__chg_field_infopage_title_de__chg_field_infopage_left_column_uk__.py b/apps/infopages/migrations/0005_auto__chg_field_infopage_title_de__chg_field_infopage_left_column_uk__.py new file mode 100644 index 000000000..184d99de6 --- /dev/null +++ b/apps/infopages/migrations/0005_auto__chg_field_infopage_title_de__chg_field_infopage_left_column_uk__.py @@ -0,0 +1,215 @@ +# -*- 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): + + # Changing field 'InfoPage.title_de' + db.alter_column(u'infopages_infopage', 'title_de', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_uk' + db.alter_column(u'infopages_infopage', 'left_column_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_pl' + db.alter_column(u'infopages_infopage', 'right_column_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_lt' + db.alter_column(u'infopages_infopage', 'right_column_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_lt' + db.alter_column(u'infopages_infopage', 'left_column_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_ru' + db.alter_column(u'infopages_infopage', 'right_column_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_fr' + db.alter_column(u'infopages_infopage', 'left_column_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_lt' + db.alter_column(u'infopages_infopage', 'title_lt', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_es' + db.alter_column(u'infopages_infopage', 'right_column_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_fr' + db.alter_column(u'infopages_infopage', 'title_fr', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_en' + db.alter_column(u'infopages_infopage', 'right_column_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_de' + db.alter_column(u'infopages_infopage', 'left_column_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_uk' + db.alter_column(u'infopages_infopage', 'title_uk', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_it' + db.alter_column(u'infopages_infopage', 'right_column_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_pl' + db.alter_column(u'infopages_infopage', 'title_pl', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_uk' + db.alter_column(u'infopages_infopage', 'right_column_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_en' + db.alter_column(u'infopages_infopage', 'title_en', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_pl' + db.alter_column(u'infopages_infopage', 'left_column_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_it' + db.alter_column(u'infopages_infopage', 'left_column_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_es' + db.alter_column(u'infopages_infopage', 'title_es', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_ru' + db.alter_column(u'infopages_infopage', 'left_column_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_de' + db.alter_column(u'infopages_infopage', 'right_column_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_es' + db.alter_column(u'infopages_infopage', 'left_column_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_en' + db.alter_column(u'infopages_infopage', 'left_column_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_fr' + db.alter_column(u'infopages_infopage', 'right_column_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_ru' + db.alter_column(u'infopages_infopage', 'title_ru', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.title_it' + db.alter_column(u'infopages_infopage', 'title_it', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + def backwards(self, orm): + + # Changing field 'InfoPage.title_de' + db.alter_column(u'infopages_infopage', 'title_de', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_uk' + db.alter_column(u'infopages_infopage', 'left_column_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_pl' + db.alter_column(u'infopages_infopage', 'right_column_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_lt' + db.alter_column(u'infopages_infopage', 'right_column_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_lt' + db.alter_column(u'infopages_infopage', 'left_column_lt', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_ru' + db.alter_column(u'infopages_infopage', 'right_column_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_fr' + db.alter_column(u'infopages_infopage', 'left_column_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_lt' + db.alter_column(u'infopages_infopage', 'title_lt', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_es' + db.alter_column(u'infopages_infopage', 'right_column_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_fr' + db.alter_column(u'infopages_infopage', 'title_fr', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_en' + db.alter_column(u'infopages_infopage', 'right_column_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_de' + db.alter_column(u'infopages_infopage', 'left_column_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_uk' + db.alter_column(u'infopages_infopage', 'title_uk', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_it' + db.alter_column(u'infopages_infopage', 'right_column_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_pl' + db.alter_column(u'infopages_infopage', 'title_pl', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.right_column_uk' + db.alter_column(u'infopages_infopage', 'right_column_uk', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_en' + db.alter_column(u'infopages_infopage', 'title_en', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_pl' + db.alter_column(u'infopages_infopage', 'left_column_pl', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_it' + db.alter_column(u'infopages_infopage', 'left_column_it', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_es' + db.alter_column(u'infopages_infopage', 'title_es', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.left_column_ru' + db.alter_column(u'infopages_infopage', 'left_column_ru', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_de' + db.alter_column(u'infopages_infopage', 'right_column_de', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_es' + db.alter_column(u'infopages_infopage', 'left_column_es', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.left_column_en' + db.alter_column(u'infopages_infopage', 'left_column_en', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.right_column_fr' + db.alter_column(u'infopages_infopage', 'right_column_fr', self.gf('django.db.models.fields.TextField')(null=True)) + + # Changing field 'InfoPage.title_ru' + db.alter_column(u'infopages_infopage', 'title_ru', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + # Changing field 'InfoPage.title_it' + db.alter_column(u'infopages_infopage', 'title_it', self.gf('django.db.models.fields.CharField')(max_length=120, null=True)) + + models = { + u'infopages.infopage': { + 'Meta': {'ordering': "('main_page', 'slug')", 'object_name': 'InfoPage'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'left_column': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'left_column_de': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_en': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_es': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_fr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_it': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_lt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_pl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_ru': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'left_column_uk': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'main_page': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'right_column': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'right_column_de': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_en': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_es': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_fr': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_it': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_lt': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_pl': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_ru': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'right_column_uk': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'}), + 'title_de': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_es': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_fr': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_it': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_lt': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_ru': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}), + 'title_uk': ('django.db.models.fields.CharField', [], {'max_length': '120', 'null': 'True', 'blank': 'True'}) + } + } + + complete_apps = ['infopages'] \ No newline at end of file diff --git a/apps/modeltranslation/__init__.py b/apps/modeltranslation/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/modeltranslation/admin.py b/apps/modeltranslation/admin.py deleted file mode 100644 index b51e3a332..000000000 --- a/apps/modeltranslation/admin.py +++ /dev/null @@ -1,140 +0,0 @@ -# -*- coding: utf-8 -*- -from copy import deepcopy - -from django import forms, template -from django.conf import settings -from django.contrib import admin -from django.contrib.contenttypes import generic - -from modeltranslation.translator import translator -from modeltranslation.utils import get_translation_fields -# Ensure that models are registered for translation before TranslationAdmin -# runs. The import is supposed to resolve a race condition between model import -# and translation registration in production (see issue 19). -import modeltranslation.models - - -class TranslationAdminBase(object): - """ - Mixin class which adds patch_translation_field functionality. - """ - def patch_translation_field(self, db_field, field, **kwargs): - trans_opts = translator.get_options_for_model(self.model) - - # Hide the original field by making it non-editable. - if db_field.name in trans_opts.fields: - db_field.editable = False - - # For every localized field copy the widget from the original field - if db_field.name in trans_opts.localized_fieldnames_rev: - orig_fieldname = trans_opts.localized_fieldnames_rev[db_field.name] - orig_formfield = self.formfield_for_dbfield( \ - self.model._meta.get_field(orig_fieldname), - **kwargs) - - # In case the original form field was required, make the default - # translation field required instead. - if db_field.language == settings.LANGUAGES[0][0] and \ - orig_formfield.required: - orig_formfield.required = False - orig_formfield.blank = True - field.required = True - field.blank = False - - field.widget = deepcopy(orig_formfield.widget) - - -class TranslationAdmin(admin.ModelAdmin, TranslationAdminBase): - def __init__(self, *args, **kwargs): - super(TranslationAdmin, self).__init__(*args, **kwargs) - - trans_opts = translator.get_options_for_model(self.model) - - # Replace original field with translation field for each language - if self.fields: - fields_new = list(self.fields) - for field in self.fields: - if field in trans_opts.fields: - index = fields_new.index(field) - translation_fields = get_translation_fields(field) - fields_new[index:index + 1] = translation_fields - self.fields = fields_new - - if self.fieldsets: - fieldsets_new = list(self.fieldsets) - for (name, dct) in self.fieldsets: - if 'fields' in dct: - fields_new = list(dct['fields']) - for field in dct['fields']: - if field in trans_opts.fields: - index = fields_new.index(field) - translation_fields = get_translation_fields(field) - fields_new[index:index + 1] = translation_fields - dct['fields'] = fields_new - self.fieldsets = fieldsets_new - - if self.list_editable: - editable_new = list(self.list_editable) - display_new = list(self.list_display) - for field in self.list_editable: - if field in trans_opts.fields: - index = editable_new.index(field) - display_index = display_new.index(field) - translation_fields = get_translation_fields(field) - editable_new[index:index + 1] = translation_fields - display_new[display_index:display_index + 1] = \ - translation_fields - self.list_editable = editable_new - self.list_display = display_new - - if self.prepopulated_fields: - prepopulated_fields_new = dict(self.prepopulated_fields) - for (k, v) in self.prepopulated_fields.items(): - translation_fields = get_translation_fields(v[0]) - prepopulated_fields_new[k] = tuple([translation_fields[0]]) - self.prepopulated_fields = prepopulated_fields_new - - def formfield_for_dbfield(self, db_field, **kwargs): - # Call the baseclass function to get the formfield - field = super(TranslationAdmin, self).formfield_for_dbfield(db_field, - **kwargs) - self.patch_translation_field(db_field, field, **kwargs) - return field - - -class TranslationTabularInline(admin.TabularInline, TranslationAdminBase): - def formfield_for_dbfield(self, db_field, **kwargs): - # Call the baseclass function to get the formfield - field = super(TranslationTabularInline, - self).formfield_for_dbfield(db_field, **kwargs) - self.patch_translation_field(db_field, field, **kwargs) - return field - - -class TranslationStackedInline(admin.StackedInline, TranslationAdminBase): - def formfield_for_dbfield(self, db_field, **kwargs): - # Call the baseclass function to get the formfield - field = super(TranslationStackedInline, - self).formfield_for_dbfield(db_field, **kwargs) - self.patch_translation_field(db_field, field, **kwargs) - return field - - -class TranslationGenericTabularInline(generic.GenericTabularInline, - TranslationAdminBase): - def formfield_for_dbfield(self, db_field, **kwargs): - # Call the baseclass function to get the formfield - field = super(TranslationGenericTabularInline, - self).formfield_for_dbfield(db_field, **kwargs) - self.patch_translation_field(db_field, field, **kwargs) - return field - - -class TranslationGenericStackedInline(generic.GenericStackedInline, - TranslationAdminBase): - def formfield_for_dbfield(self, db_field, **kwargs): - # Call the baseclass function to get the formfield - field = super(TranslationGenericStackedInline, - self).formfield_for_dbfield(db_field, **kwargs) - self.patch_translation_field(db_field, field, **kwargs) - return field diff --git a/apps/modeltranslation/fields.py b/apps/modeltranslation/fields.py deleted file mode 100644 index fe413ce3e..000000000 --- a/apps/modeltranslation/fields.py +++ /dev/null @@ -1,111 +0,0 @@ -# -*- coding: utf-8 -*- -from django.conf import settings -from django.db.models.fields import Field, CharField -from django.utils.translation import string_concat - -from modeltranslation.utils import get_language, build_localized_fieldname - - -class TranslationField(Field): - """ - The translation field functions as a proxy to the original field which is - wrapped. - - For every field defined in the model's ``TranslationOptions`` localized - versions of that field are added to the model depending on the languages - given in ``settings.LANGUAGES``. - - If for example there is a model ``News`` with a field ``title`` which is - registered for translation and the ``settings.LANGUAGES`` contains the - ``de`` and ``en`` languages, the fields ``title_de`` and ``title_en`` will - be added to the model class. These fields are realized using this - descriptor. - - The translation field needs to know which language it contains therefore - that needs to be specified when the field is created. - """ - def __init__(self, translated_field, language, *args, **kwargs): - # Store the originally wrapped field for later - self.translated_field = translated_field - self.language = language - - # Update the dict of this field with the content of the original one - # This might be a bit radical?! Seems to work though... - self.__dict__.update(translated_field.__dict__) - - # Translation are always optional (for now - maybe add some parameters - # to the translation options for configuring this) - self.null = True - self.blank = True - - # Adjust the name of this field to reflect the language - self.attname = build_localized_fieldname(translated_field.name, - language) - self.name = self.attname - - # Copy the verbose name and append a language suffix (will e.g. in the - # admin). This might be a proxy function so we have to check that here. - self.verbose_name = string_concat(translated_field.verbose_name, - ' [%s]' % (language, )) - - def pre_save(self, model_instance, add): - val = super(TranslationField, self).pre_save(model_instance, add) - if get_language() == self.language and not add: - # Rule is: 3. Assigning a value to a translation field of the - # default language also updates the original field - model_instance.__dict__[self.translated_field.name] = val - return val - - def get_internal_type(self): - return self.translated_field.get_internal_type() - - #def contribute_to_class(self, cls, name): - #super(TranslationField, self).contribute_to_class(cls, name) - ##setattr(cls, 'get_%s_display' % self.name, - ##curry(cls._get_FIELD_display, field=self)) - - def south_field_triple(self): - """Returns a suitable description of this field for South.""" - # We'll just introspect the _actual_ field. - from south.modelsinspector import introspector - field_class = '%s.%s' % (self.translated_field.__class__.__module__, - self.translated_field.__class__.__name__) - args, kwargs = introspector(self.translated_field) - - # This is patched in init and so should be here! -- lqc - kwargs['blank'], kwargs['null'] = True, True - - # That's our definition! - return (field_class, args, kwargs) - - def formfield(self, *args, **kwargs): - """Preserves the widget of the translated field.""" - trans_formfield = self.translated_field.formfield(*args, **kwargs) - defaults = {'widget': type(trans_formfield.widget)} - defaults.update(kwargs) - return super(TranslationField, self).formfield(*args, **defaults) - - -#class CurrentLanguageField(CharField): - #def __init__(self, **kwargs): - #super(CurrentLanguageField, self).__init__(null=True, max_length=5, - #**kwargs) - - #def contribute_to_class(self, cls, name): - #super(CurrentLanguageField, self).contribute_to_class(cls, name) - #registry = CurrentLanguageFieldRegistry() - #registry.add_field(cls, self) - - -#class CurrentLanguageFieldRegistry(object): - #_registry = {} - - #def add_field(self, model, field): - #reg = self.__class__._registry.setdefault(model, []) - #reg.append(field) - - #def get_fields(self, model): - #return self.__class__._registry.get(model, []) - - #def __contains__(self, model): - #return model in self.__class__._registry diff --git a/apps/modeltranslation/management/__init__.py b/apps/modeltranslation/management/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/modeltranslation/management/commands/__init__.py b/apps/modeltranslation/management/commands/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/modeltranslation/management/commands/update_translation_fields.py b/apps/modeltranslation/management/commands/update_translation_fields.py deleted file mode 100644 index 78cd74298..000000000 --- a/apps/modeltranslation/management/commands/update_translation_fields.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- -from django.conf import settings -from django.core.management.base import (BaseCommand, CommandError, - NoArgsCommand) -from optparse import make_option - -from modeltranslation.translator import translator -from modeltranslation.utils import build_localized_fieldname - - -class Command(NoArgsCommand): - help = 'Updates the default translation fields of all or the specified' \ - 'translated application using the value of the original field.' - - option_list = BaseCommand.option_list + ( - make_option('-d', '--default', action='store', dest='default', default=None), ) - - - def handle(self, **options): - if options['default']: - default_lang = options['default'] - else: - default_lang = settings.LANGUAGES[0][0] - print "Using default language:", default_lang - - for model, trans_opts in translator._registry.items(): - print "Updating data of model '%s'" % model - for obj in model.objects.all(): - for fieldname in trans_opts.fields: - def_lang_fieldname = \ - build_localized_fieldname(fieldname, default_lang) - #print "setting %s from %s to %s." % \ - #(def_lang_fieldname, fieldname, - #obj.__dict__[fieldname]) - if not getattr(obj, def_lang_fieldname): - setattr(obj, def_lang_fieldname, - obj.__dict__[fieldname]) - obj.save() diff --git a/apps/modeltranslation/models.py b/apps/modeltranslation/models.py deleted file mode 100644 index 739c89706..000000000 --- a/apps/modeltranslation/models.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -import sys - -from django.conf import settings -from django.core.exceptions import ImproperlyConfigured -from django.db import models - -from modeltranslation.translator import translator - -# Every model registered with the modeltranslation.translator.translator -# is patched to contain additional localized versions for every -# field specified in the model's translation options. - -# Import the project's global "translation.py" which registers model -# classes and their translation options with the translator object. -if getattr(settings, 'TRANSLATION_REGISTRY', False): - try: - __import__(settings.TRANSLATION_REGISTRY, {}, {}, ['']) - except ImportError: - sys.stderr.write("modeltranslation: Can't import module '%s'.\n" - "(If the module exists, it's causing an " - "ImportError somehow.)\n" %\ - settings.TRANSLATION_REGISTRY) - # For some reason ImportErrors raised in translation.py or in modules - # that are included from there become swallowed. Work around this - # problem by printing the traceback explicitly. - import traceback - traceback.print_exc() - - # After importing all translation modules, all translation classes are - # registered with the translator. - if settings.DEBUG: - try: - if sys.argv[1] in ('runserver', 'runserver_plus'): - translated_model_names = ', '.join( - t.__name__ for t in translator._registry.keys()) - print('modeltranslation: Registered %d models for ' - 'translation (%s).' % (len(translator._registry), - translated_model_names)) - except IndexError: - pass -else: - raise ImproperlyConfigured("You haven't set the TRANSLATION_REGISTRY " - "setting yet.") diff --git a/apps/modeltranslation/tests.py b/apps/modeltranslation/tests.py deleted file mode 100644 index 3e0f39bb8..000000000 --- a/apps/modeltranslation/tests.py +++ /dev/null @@ -1,258 +0,0 @@ -# -*- coding: utf-8 -*- -from django.conf import settings -from django.contrib.auth.models import User -from django.contrib.contenttypes.models import ContentType -from django.db import models -from django.test import TestCase -from django.utils.thread_support import currentThread -from django.utils.translation import get_language -from django.utils.translation import trans_real - -# TODO: tests for TranslationAdmin - -from modeltranslation import translator - -settings.LANGUAGES = (('de', 'Deutsch'), - ('en', 'English')) - - -class TestModel(models.Model): - title = models.CharField(max_length=255) - text = models.TextField(null=True) - - -class TestTranslationOptions(translator.TranslationOptions): - fields = ('title', 'text',) - - -translator.translator._registry = {} -translator.translator.register(TestModel, TestTranslationOptions) - - -class ModelTranslationTest(TestCase): - """Basic tests for the modeltranslation application.""" - urls = 'modeltranslation.testurls' - - def setUp(self): - trans_real.activate("de") - - def tearDown(self): - trans_real.deactivate() - - def test_registration(self): - self.client.post('/set_language/', data={'language': 'de'}) - #self.client.session['django_language'] = 'de-de' - #self.client.cookies[settings.LANGUAGE_COOKIE_NAME] = 'de-de' - - langs = tuple(l[0] for l in settings.LANGUAGES) - self.failUnlessEqual(2, len(langs)) - self.failUnless('de' in langs) - self.failUnless('en' in langs) - self.failUnless(translator.translator) - - # Check that only one model is registered for translation - self.failUnlessEqual(len(translator.translator._registry), 1) - - # Try to unregister a model that is not registered - self.assertRaises(translator.NotRegistered, - translator.translator.unregister, User) - - # Try to get options for a model that is not registered - self.assertRaises(translator.NotRegistered, - translator.translator.get_options_for_model, User) - - def test_translated_models(self): - # First create an instance of the test model to play with - inst = TestModel.objects.create(title="Testtitle", text="Testtext") - field_names = dir(inst) - self.failUnless('id' in field_names) - self.failUnless('title' in field_names) - self.failUnless('text' in field_names) - self.failUnless('title_de' in field_names) - self.failUnless('title_en' in field_names) - self.failUnless('text_de' in field_names) - self.failUnless('text_en' in field_names) - - inst.delete() - - def test_set_translation(self): - self.failUnlessEqual(get_language(), "de") - # First create an instance of the test model to play with - title1_de = "title de" - title1_en = "title en" - title2_de = "title2 de" - inst1 = TestModel(title_en=title1_en, text="Testtext") - inst1.title = title1_de - inst2 = TestModel(title=title2_de, text="Testtext") - inst1.save() - inst2.save() - - self.failUnlessEqual(inst1.title, title1_de) - self.failUnlessEqual(inst1.title_en, title1_en) - - self.failUnlessEqual(inst2.title, title2_de) - self.failUnlessEqual(inst2.title_en, None) - - del inst1 - del inst2 - - # Check that the translation fields are correctly saved and provide the - # correct value when retrieving them again. - n = TestModel.objects.get(title=title1_de) - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - - def test_titleonly(self): - title1_de = "title de" - n = TestModel.objects.create(title=title1_de) - self.failUnlessEqual(n.title, title1_de) - # Because the original field "title" was specified in the constructor - # it is directly passed into the instance's __dict__ and the descriptor - # which updates the associated default translation field is not called - # and the default translation will be None. - self.failUnlessEqual(n.title_de, None) - self.failUnlessEqual(n.title_en, None) - - # Now assign the title, that triggers the descriptor and the default - # translation field is updated - n.title = title1_de - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, None) - - def test_rule1(self): - """ - Rule 1: Reading the value from the original field returns the value in - translated to the current language. - """ - title1_de = "title de" - title1_en = "title en" - text_de = "Dies ist ein deutscher Satz" - text_en = "This is an english sentence" - - # Test 1. - n = TestModel.objects.create(title_de=title1_de, title_en=title1_en, - text_de=text_de, text_en=text_en) - n.save() - - # language is set to "de" at this point - self.failUnlessEqual(get_language(), "de") - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - self.failUnlessEqual(n.text, text_de) - self.failUnlessEqual(n.text_de, text_de) - self.failUnlessEqual(n.text_en, text_en) - # Now switch to "en" - trans_real.activate("en") - self.failUnlessEqual(get_language(), "en") - # Title should now be return the english one (just by switching the - # language) - self.failUnlessEqual(n.title, title1_en) - self.failUnlessEqual(n.text, text_en) - - n = TestModel.objects.create(title_de=title1_de, title_en=title1_en, - text_de=text_de, text_en=text_en) - n.save() - # language is set to "en" at this point - self.failUnlessEqual(n.title, title1_en) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - self.failUnlessEqual(n.text, text_en) - self.failUnlessEqual(n.text_de, text_de) - self.failUnlessEqual(n.text_en, text_en) - trans_real.activate("de") - self.failUnlessEqual(get_language(), "de") - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.text, text_de) - trans_real.deactivate() - - def test_rule2(self): - """ - Rule 2: Assigning a value to the original field also updates the value - in the associated translation field of the default language - """ - self.failUnlessEqual(get_language(), "de") - title1_de = "title de" - title1_en = "title en" - n = TestModel.objects.create(title_de=title1_de, title_en=title1_en) - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - - title2 = "Neuer Titel" - n.title = title2 - n.save() - self.failUnlessEqual(n.title, title2) - self.failUnlessEqual(n.title, n.title_de) - - trans_real.activate("en") - self.failUnlessEqual(get_language(), "en") - title3 = "new title" - - n.title = title3 - n.title_de = title1_de - n.save() - self.failUnlessEqual(n.title, title3) - self.failUnlessEqual(n.title, n.title_en) - self.failUnlessEqual(title1_de, n.title_de) - - trans_real.deactivate() - - def test_rule3(self): - """ - Rule 3: Assigning a value to a translation field of the default - language also updates the original field - note that the value of the - original field will not be updated until the model instance is saved. - """ - title1_de = "title de" - title1_en = "title en" - n = TestModel.objects.create(title_de=title1_de, title_en=title1_en) - self.failUnlessEqual(get_language(), "de") - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - - n.title_de = "Neuer Titel" - n.save() - self.failUnlessEqual(n.title, n.title_de) - - # Now switch to "en" - trans_real.activate("en") - self.failUnlessEqual(get_language(), "en") - n.title_en = "New title" - # the n.title field is not updated before the instance is saved - n.save() - self.failUnlessEqual(n.title, n.title_en) - trans_real.deactivate() - - def test_rule4(self): - """ - Rule 4: If both fields - the original and the translation field of the - default language - are updated at the same time, the translation field - wins. - """ - self.failUnlessEqual(get_language(), "de") - title1_de = "title de" - title1_en = "title en" - n = TestModel.objects.create(title_de=title1_de, title_en=title1_en) - self.failUnlessEqual(n.title, title1_de) - self.failUnlessEqual(n.title_de, title1_de) - self.failUnlessEqual(n.title_en, title1_en) - - title2_de = "neu de" - title2_en = "new en" - title_foo = "foo" - n.title = title_foo - n.title_de = title2_de - n.title_en = title2_en - n.save() - self.failUnlessEqual(n.title, title2_de) - self.failUnlessEqual(n.title_de, title2_de) - self.failUnlessEqual(n.title_en, title2_en) - - n.title = title_foo - n.save() - self.failUnlessEqual(n.title, title_foo) - self.failUnlessEqual(n.title_de, title_foo) - self.failUnlessEqual(n.title_en, title2_en) diff --git a/apps/modeltranslation/testurls.py b/apps/modeltranslation/testurls.py deleted file mode 100644 index a789ee3b9..000000000 --- a/apps/modeltranslation/testurls.py +++ /dev/null @@ -1,7 +0,0 @@ -# -*- coding: utf-8 -*- -from django.conf.urls import patterns, url - -urlpatterns = patterns('', - url(r'^set_language/$', 'django.views.i18n.set_language', {}, - name='set_language'), -) diff --git a/apps/modeltranslation/translator.py b/apps/modeltranslation/translator.py deleted file mode 100644 index 0a5536261..000000000 --- a/apps/modeltranslation/translator.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- coding: utf-8 -*- -from django.conf import settings -#from django.contrib.contenttypes.models import ContentType -from django.db import models -from django.db.models import signals -from django.db.models.base import ModelBase -from django.utils.functional import curry - -from modeltranslation.fields import TranslationField -from modeltranslation.utils import (TranslationFieldDescriptor, - build_localized_fieldname) - - -class AlreadyRegistered(Exception): - pass - - -class NotRegistered(Exception): - pass - - -class TranslationOptions(object): - """ - The TranslationOptions object is used to specify the fields to translate. - - The options are registered in combination with a model class at the - ``modeltranslation.translator.translator`` instance. - - It caches the content type of the translated model for faster lookup later - on. - """ - def __init__(self, *args, **kwargs): - # self.translation_model = None - #self.model_ct = None - self.localized_fieldnames = list() - - -def add_localized_fields(model): - """ - Monkey patchs the original model class to provide additional fields for - every language. Only do that for fields which are defined in the - translation options of the model. - - Returns a dict mapping the original fieldname to a list containing the - names of the localized fields created for the original field. - """ - localized_fields = dict() - translation_opts = translator.get_options_for_model(model) - for field_name in translation_opts.fields: - localized_fields[field_name] = list() - for l in settings.LANGUAGES: - # Construct the name for the localized field - localized_field_name = build_localized_fieldname(field_name, l[0]) - # Check if the model already has a field by that name - if hasattr(model, localized_field_name): - raise ValueError("Error adding translation field. The model "\ - "'%s' already contains a field named '%s'. "\ - % (instance.__class__.__name__, - localized_field_name)) - - # This approach implements the translation fields as full valid - # django model fields and therefore adds them via add_to_class - localized_field = model.add_to_class( \ - localized_field_name, - TranslationField(model._meta.get_field(field_name), l[0])) - localized_fields[field_name].append(localized_field_name) - return localized_fields - - -#def translated_model_initialized(field_names, instance, **kwargs): - #print "translated_model_initialized instance:", \ - #instance, ", field:", field_names - #for field_name in field_names: - #initial_val = getattr(instance, field_name) - #print " field: %s, initialval: %s" % (field_name, initial_val) - #setattr(instance.__class__, field_name, - #TranslationFieldDescriptor(field_name, initial_val)) - - -#def translated_model_initializing(sender, args, kwargs, **signal_kwargs): - #print "translated_model_initializing", sender, args, kwargs - #trans_opts = translator.get_options_for_model(sender) - #for field_name in trans_opts.fields: - #setattr(sender, field_name, TranslationFieldDescriptor(field_name)) - - -class Translator(object): - """ - A Translator object encapsulates an instance of a translator. Models are - registered with the Translator using the register() method. - """ - def __init__(self): - # model_class class -> translation_opts instance - self._registry = {} - - def register(self, model_or_iterable, translation_opts, **options): - """ - Registers the given model(s) with the given translation options. - - The model(s) should be Model classes, not instances. - - If a model is already registered for translation, this will raise - AlreadyRegistered. - """ - # Don't import the humongous validation code unless required - if translation_opts and settings.DEBUG: - from django.contrib.admin.validation import validate - else: - validate = lambda model, adminclass: None - - #if not translation_opts: - #translation_opts = TranslationOptions - if isinstance(model_or_iterable, ModelBase): - model_or_iterable = [model_or_iterable] - - for model in model_or_iterable: - if model in self._registry: - raise AlreadyRegistered('The model %s is already registered ' - 'for translation' % model.__name__) - - # If we got **options then dynamically construct a subclass of - # translation_opts with those **options. - if options: - # For reasons I don't quite understand, without a __module__ - # the created class appears to "live" in the wrong place, - # which causes issues later on. - options['__module__'] = __name__ - translation_opts = type("%sAdmin" % model.__name__, - (translation_opts,), options) - - # Validate (which might be a no-op) - #validate(translation_opts, model) - - # Store the translation class associated to the model - self._registry[model] = translation_opts - - # Get the content type of the original model and store it on the - # translation options for faster lookup later on. - #translation_opts.model_ct = \ - #ContentType.objects.get_for_model(model) - - # Add the localized fields to the model and store the names of - # these fields in the model's translation options for faster lookup - # later on. - translation_opts.localized_fieldnames = add_localized_fields(model) - - # Create a reverse dict mapping the localized_fieldnames to the - # original fieldname - rev_dict = dict() - for orig_name, loc_names in \ - translation_opts.localized_fieldnames.items(): - for ln in loc_names: - rev_dict[ln] = orig_name - - translation_opts.localized_fieldnames_rev = rev_dict - - # print "Applying descriptor field for model %s" % model - for field_name in translation_opts.fields: - setattr(model, field_name, TranslationFieldDescriptor(field_name)) - - #signals.pre_init.connect(translated_model_initializing, sender=model, - #weak=False) - - def unregister(self, model_or_iterable): - """ - Unregisters the given model(s). - - If a model isn't already registered, this will raise NotRegistered. - """ - if isinstance(model_or_iterable, ModelBase): - model_or_iterable = [model_or_iterable] - for model in model_or_iterable: - if model not in self._registry: - raise NotRegistered('The model "%s" is not registered for ' - 'translation' % model.__name__) - del self._registry[model] - - def get_options_for_model(self, model): - """ - Returns the translation options for the given ``model``. If the - ``model`` is not registered a ``NotRegistered`` exception is raised. - """ - try: - return self._registry[model] - except KeyError: - raise NotRegistered('The model "%s" is not registered for ' - 'translation' % model.__name__) - - -# This global object represents the singleton translator object -translator = Translator() diff --git a/apps/modeltranslation/utils.py b/apps/modeltranslation/utils.py deleted file mode 100644 index aeb57d14a..000000000 --- a/apps/modeltranslation/utils.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- -from django.db import models -from django.conf import settings -from django.core.exceptions import ValidationError -from django.contrib.contenttypes.models import ContentType -from django.utils.translation import get_language as _get_language - - -def get_language(): - """ - Return an active language code that is guaranteed to be in - settings.LANGUAGES (Django does not seem to guarantee this for us.) - - """ - lang = _get_language() - available_languages = [l[0] for l in settings.LANGUAGES] - if lang not in available_languages and '-' in lang: - lang = lang.split('-')[0] - if lang in available_languages: - return lang - return available_languages[0] - - -def get_translation_fields(field): - """Returns a list of localized fieldnames for a given field.""" - return [build_localized_fieldname(field, l[0]) for l in settings.LANGUAGES] - - -def build_localized_fieldname(field_name, lang): - return '%s_%s' % (field_name, lang.replace('-', '_')) - - -class TranslationFieldDescriptor(object): - """A descriptor used for the original translated field.""" - def __init__(self, name, initial_val=""): - """ - The ``name`` is the name of the field (which is not available in the - descriptor by default - this is Python behaviour). - """ - self.name = name - self.val = initial_val - - def __set__(self, instance, value): - lang = get_language() - loc_field_name = build_localized_fieldname(self.name, lang) - # also update the translation field of the current language - setattr(instance, loc_field_name, value) - # update the original field via the __dict__ to prevent calling the - # descriptor - instance.__dict__[self.name] = value - - def __get__(self, instance, owner): - if not instance: - raise ValueError(u"Translation field '%s' can only be " - "accessed via an instance not via " - "a class." % self.name) - lang = get_language() - loc_field_name = build_localized_fieldname(self.name, lang) - if hasattr(instance, loc_field_name): - return getattr(instance, loc_field_name) or \ - instance.__dict__[self.name] - return instance.__dict__[self.name] - - -#def create_model(name, fields=None, app_label='', module='', options=None, - #admin_opts=None): - #""" - #Create specified model. - #This is taken from http://code.djangoproject.com/wiki/DynamicModels - #""" - #class Meta: - ## Using type('Meta', ...) gives a dictproxy error during model - ## creation - #pass - - #if app_label: - ## app_label must be set using the Meta inner class - #setattr(Meta, 'app_label', app_label) - - ## Update Meta with any options that were provided - #if options is not None: - #for key, value in options.iteritems(): - #setattr(Meta, key, value) - - ## Set up a dictionary to simulate declarations within a class - #attrs = {'__module__': module, 'Meta': Meta} - - ## Add in any fields that were provided - #if fields: - #attrs.update(fields) - - ## Create the class, which automatically triggers ModelBase processing - #model = type(name, (models.Model,), attrs) - - ## Create an Admin class if admin options were provided - #if admin_opts is not None: - #class Admin(admin.ModelAdmin): - #pass - #for key, value in admin_opts: - #setattr(Admin, key, value) - #admin.site.register(model, Admin) - - #return model - - -def copy_field(field): - """ - Instantiate a new field, with all of the values from the old one, except - the to and to_field in the case of related fields. - - This taken from http://www.djangosnippets.org/snippets/442/ - """ - base_kw = dict([(n, getattr(field, n, '_null')) for n in \ - models.fields.Field.__init__.im_func.func_code.co_varnames]) - if isinstance(field, models.fields.related.RelatedField): - rel = base_kw.get('rel') - rel_kw = dict([(n, getattr(rel, n, '_null')) for n in \ - rel.__init__.im_func.func_code.co_varnames]) - if isinstance(field, models.fields.related.ForeignKey): - base_kw['to_field'] = rel_kw.pop('field_name') - base_kw.update(rel_kw) - base_kw.pop('self') - return field.__class__(**base_kw) diff --git a/apps/stats/utils.py b/apps/stats/utils.py index a10c48ac5..921921d4c 100644 --- a/apps/stats/utils.py +++ b/apps/stats/utils.py @@ -3,7 +3,6 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.contrib.sites.models import Site -from piwik.django.models import PiwikSite from django.conf import settings from datetime import datetime import logging @@ -18,7 +17,7 @@ logger = logging.getLogger(__name__) def piwik_url(request): return urllib.urlencode(dict( - idsite=_id_piwik, + idsite=getattr(settings, 'PIWIK_SITE_ID', '0'), rec=1, url='http://%s%s' % (request.META['HTTP_HOST'], request.path), rand=int(random() * 0x10000), @@ -34,18 +33,11 @@ def piwik_url(request): PIWIK_API_VERSION = 1 -# Retrieve piwik information -try: - _id_piwik = PiwikSite.objects.get(site=Site.objects.get_current().id).id_site -except PiwikSite.DoesNotExist: - logger.debug("No PiwikSite is configured.") - _id_piwik = None - def piwik_track(klass_or_method): """Track decorated class or method using Piwik (according to configuration in settings and django-piwik) Works for handler classes (executed by __call__) or handler methods. Expects request to be the first parameter """ - if _id_piwik is None: + if not getattr(settings, 'PIWIK_SITE_ID', 0): return klass_or_method # get target method diff --git a/apps/suggest/forms.py b/apps/suggest/forms.py index 1a5554336..35fbaf646 100644 --- a/apps/suggest/forms.py +++ b/apps/suggest/forms.py @@ -6,7 +6,7 @@ from django import forms from django.contrib.sites.models import Site from django.core.mail import send_mail, mail_managers from django.core.urlresolvers import reverse -from django.core.validators import email_re +from django.core.validators import validate_email from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext from suggest.models import PublishingSuggestion, Suggestion @@ -41,7 +41,7 @@ Kontakt: %(contact)s 'description': description, }, fail_silently=True) - if email_re.match(contact): + if validate_email(contact): send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\ @@ -96,7 +96,7 @@ Audiobooki: 'audiobooks': audiobooks, }, fail_silently=True) - if email_re.match(contact): + if validate_email(contact): send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\ diff --git a/apps/wolnelektury_core/management/commands/localepack.py b/apps/wolnelektury_core/management/commands/localepack.py index 26eee83a5..3c1a710d8 100644 --- a/apps/wolnelektury_core/management/commands/localepack.py +++ b/apps/wolnelektury_core/management/commands/localepack.py @@ -6,7 +6,7 @@ from optparse import make_option from django.conf import settings from django.core.management.base import BaseCommand from django.core.management import call_command -from modeltranslation.management.commands.translation2po import get_languages +from .translation2po import get_languages import os import shutil diff --git a/apps/modeltranslation/management/commands/translation2po.py b/apps/wolnelektury_core/management/commands/translation2po.py similarity index 78% rename from apps/modeltranslation/management/commands/translation2po.py rename to apps/wolnelektury_core/management/commands/translation2po.py index e9ec30272..02a1d0868 100644 --- a/apps/modeltranslation/management/commands/translation2po.py +++ b/apps/wolnelektury_core/management/commands/translation2po.py @@ -1,4 +1,7 @@ - +# -*- coding: utf-8 -*- +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# import os import sys import time @@ -6,6 +9,7 @@ from optparse import make_option from django.conf import settings from django.core.management.base import BaseCommand from django.core.management.color import color_style +from django.db import models import polib import modeltranslation.models @@ -18,7 +22,7 @@ def metadata(language=''): return { 'Project-Id-Version': '1.0', - 'Report-Msgid-Bugs-To': 'marcin.koziej@nowoczesnapolska.org.pl', + 'Report-Msgid-Bugs-To': settings.CONTACT_EMAIL, 'POT-Creation-Date': '%s' % t, 'PO-Revision-Date': '%s' % t, 'Last-Translator': 'you ', @@ -29,11 +33,6 @@ def metadata(language=''): } -def lang(field_name): - "Get the language code from localized field name" - return field_name.split('_')[-1] - - def make_po(language=''): "Create new POFile object for language code" po = polib.POFile() @@ -50,7 +49,7 @@ def get_languages(langs): class Command(BaseCommand): option_list = BaseCommand.option_list + ( - make_option('-d', '--directory', help='Specify which directory should hold generated PO files', dest='directory'), + make_option('-d', '--directory', help='Specify which directory should hold generated PO files', dest='directory', default=''), make_option('-l', '--load', help='load locales back to source', action='store_true', dest='load', default=False), make_option('-L', '--language', help='locales to load', dest='lang', default=None), make_option('-n', '--poname', help='name of the po file [no extension]', dest='poname', default=None), @@ -60,16 +59,20 @@ class Command(BaseCommand): args = 'app' def get_models(self, app): - r = [] for mdname in dir(app.models): if mdname[0] == '_': continue md = getattr(app.models, mdname) + try: + assert issubclass(md, models.Model) + except (AssertionError, TypeError): + continue + try: opts = translator.get_options_for_model(md) - r.append((md, opts)) except NotRegistered: continue - return r + else: + yield (md, opts) def handle(self, appname, **options): if not options['poname']: options['poname'] = appname @@ -94,8 +97,8 @@ class Command(BaseCommand): raise OSError('%s po file: %s not found' % (appname, pofile)) po = polib.pofile(pofile) for entry in po: - loc, pk = entry.occurrences[0] - _appname, modelname, fieldname = loc.split('/') + loc, _ignored = entry.occurrences[0] + _appname, modelname, fieldname, pk = loc.split('/') try: obj = objects[modelname][pk] except KeyError: @@ -111,28 +114,23 @@ class Command(BaseCommand): pofiles = {} for md, opts in self.get_models(app): for obj in md.objects.all().order_by('pk'): - for fld in opts.fields: - for locfld in opts.localized_fieldnames[fld]: - cur_lang = lang(locfld) + for fld, locflds in opts.local_fields.items(): + k = getattr(obj, '%s_%s' % (fld, settings.LANGUAGE_CODE)) or '' + for locfld in locflds: + cur_lang = locfld.language try: po = pofiles[cur_lang] except: po = make_po(cur_lang) pofiles[cur_lang] = po - - k = getattr(obj, '%s_%s' % (fld, settings.LANGUAGE_CODE)) - if k is None: k = '' - v = getattr(obj, locfld) - if v is None: v = '' + v = locfld.value_from_object(obj) or '' entry = polib.POEntry( msgid=k, msgstr=v, - occurrences=[('%s/%s/%s' % (appname, md.__name__, locfld), obj.id)]) + occurrences=[('%s/%s/%s/%s' % (appname, md.__name__, locfld.name, str(obj.pk)), 0)]) po.append(entry) directory = options['directory'] for lng, po in pofiles.items(): - try: os.makedirs(os.path.join(directory, lng)) - except OSError: pass - print lng, options + os.makedirs(os.path.join(directory, lng)) po.save(os.path.join(directory, lng, '%s.po' % options['poname'])) diff --git a/apps/wolnelektury_core/static/fonts/WL-Nav.eot b/apps/wolnelektury_core/static/fonts/WL-Nav.eot deleted file mode 100644 index f241aa124678b70114ca53202af8896a28389d34..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2952 zcmd5;Uu;{|8UN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%m19 z-M^Z4Yr%G%a*;rM`U!3X)U3bUek*%@-}QZC{Ry{p0(&R$+IwGESkiiF4q&W z=6KVk{iVS);VZ^n&19COQa^ko662M22c?P$szzJhQSZ2>ghCPPz6c&k7DajLA|DGR z(;HP5Y zlgs)an<)Klj^CH0wk!xRK;n7Ksw$#ZLqUPcc_!?AEECUEq5 zRX*ITUn#c~0jE>tY?4AzfyzP%lq!xuEr;JN1P263rZ_0@I2HvBP8KoL8(x5a1Qg0& zG}eGmMAjncn>*jFQ|R+O8Y3C~OOJ*Rb=>{hXP>DqKHKASNX9SrXdWr}yFFR}{@b7l zPQm`K!QG`X9KrmsM-w>0`FW3~Xc|X)G>0_&=^o7^2fxyz1>pY;It1U|3uq3$zu7^M zgC0cJ;CT`_^T1gK`Ve{)dJh3ThX#9>gRc0;M@t}|^pA(O{PzaB2%{V{1g43!)8w+z=3-iu{*PN4c^9#$)p-1N)TAmw( z=3Ke7wd72$t!_=OZCqS%hN^X^e`#xLeNU~n2;4=+t!^$>R~NRx(np+fom$HZ1*BjM(z3%)ngY2{fTIbUc=|{CFFxg=v90&lm sDRd0YpcAknPQe+@X>^uJ;ryn1HU*tGpIHM8aQ+qj-m?EzzIFHi0H}D~6aWAK diff --git a/apps/wolnelektury_core/static/fonts/WL.ttf b/apps/wolnelektury_core/static/fonts/WL.ttf deleted file mode 100644 index 6a8934a1b9a766c61896e2bb75b8afa87b177b78..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5248 zcmd5=Yiu0Xb-s^z?sH~$9{Ze~eQ=gsabMi!E-6uzD47%^lcuCtGOZ|I?53kcE2K+c_+*;s3}z!K6R{oKOY&8=)6rJ?@{^!F~Wo}TG` zD`SBE7ondyJF~Th7PvnJ`2h6om6@}1XTS3Hn+U0E2$AR3RyQ_(@Y=3F0{;rg4EY{TC;LL;r=m^gZC9H&d6NzuvZ5t+x}G{LH_E2;;&9I)1(NHaebo0`Q>3CD&40 z)_y83N8v6Yhz>5MiCx}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_)5SP@6zjA$C2 nfH%T(D~o;A(Lq-k!$}ddh*|HACszRvoWBL%Tyopg<%j0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=0)&&c(a).is(":focusable")}})}})(jQuery); -;/*! - * jQuery UI Widget 1.8.2 - * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Widget - */ -(function(b){var j=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add(this).each(function(){b(this).triggerHandler("remove")});return j.call(b(this),a,c)})};b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend({},c.options);b[e][a].prototype= -b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.substring(0,1)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==undefined){h=i;return false}}):this.each(function(){var g= -b.data(this,a);if(g){d&&g.option(d);g._init()}else b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){this.element=b(c).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(c)[this.widgetName],a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create(); -this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a,e=this;if(arguments.length===0)return b.extend({},e.options);if(typeof a==="string"){if(c===undefined)return this.options[a];d={};d[a]=c}b.each(d,function(f, -h){e._setOption(f,h)});return e},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a= -b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery); -;/* - * jQuery UI Position 1.8.2 - * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var m=/left|center|right/,n=/top|center|bottom/,p=c.fn.position,q=c.fn.offset;c.fn.position=function(a){if(!a||!a.of)return p.apply(this,arguments);a=c.extend({},a);var b=c(a.of),d=(a.collision||"flip").split(" "),e=a.offset?a.offset.split(" "):[0,0],g,h,i;if(a.of.nodeType===9){g=b.width();h=b.height();i={top:0,left:0}}else if(a.of.scrollTo&&a.of.document){g=b.width();h=b.height();i={top:b.scrollTop(),left:b.scrollLeft()}}else if(a.of.preventDefault){a.at="left top";g=h= -0;i={top:a.of.pageY,left:a.of.pageX}}else{g=b.outerWidth();h=b.outerHeight();i=b.offset()}c.each(["my","at"],function(){var f=(a[this]||"").split(" ");if(f.length===1)f=m.test(f[0])?f.concat(["center"]):n.test(f[0])?["center"].concat(f):["center","center"];f[0]=m.test(f[0])?f[0]:"center";f[1]=n.test(f[1])?f[1]:"center";a[this]=f});if(d.length===1)d[1]=d[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(a.at[0]==="right")i.left+=g;else if(a.at[0]==="center")i.left+= -g/2;if(a.at[1]==="bottom")i.top+=h;else if(a.at[1]==="center")i.top+=h/2;i.left+=e[0];i.top+=e[1];return this.each(function(){var f=c(this),k=f.outerWidth(),l=f.outerHeight(),j=c.extend({},i);if(a.my[0]==="right")j.left-=k;else if(a.my[0]==="center")j.left-=k/2;if(a.my[1]==="bottom")j.top-=l;else if(a.my[1]==="center")j.top-=l/2;j.left=parseInt(j.left);j.top=parseInt(j.top);c.each(["left","top"],function(o,r){c.ui.position[d[o]]&&c.ui.position[d[o]][r](j,{targetWidth:g,targetHeight:h,elemWidth:k, -elemHeight:l,offset:e,my:a.my,at:a.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(j,{using:a.using}))})};c.ui.position={fit:{left:function(a,b){var d=c(window);b=a.left+b.elemWidth-d.width()-d.scrollLeft();a.left=b>0?a.left-b:Math.max(0,a.left)},top:function(a,b){var d=c(window);b=a.top+b.elemHeight-d.height()-d.scrollTop();a.top=b>0?a.top-b:Math.max(0,a.top)}},flip:{left:function(a,b){if(b.at[0]!=="center"){var d=c(window);d=a.left+b.elemWidth-d.width()-d.scrollLeft();var e=b.my[0]==="left"? --b.elemWidth:b.my[0]==="right"?b.elemWidth:0,g=-2*b.offset[0];a.left+=a.left<0?e+b.targetWidth+g:d>0?e-b.targetWidth+g:0}},top:function(a,b){if(b.at[1]!=="center"){var d=c(window);d=a.top+b.elemHeight-d.height()-d.scrollTop();var e=b.my[1]==="top"?-b.elemHeight:b.my[1]==="bottom"?b.elemHeight:0,g=b.at[1]==="top"?b.targetHeight:-b.targetHeight,h=-2*b.offset[1];a.top+=a.top<0?e+b.targetHeight+h:d>0?e+g+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(a,b){if(/static/.test(c.curCSS(a,"position")))a.style.position= -"relative";var d=c(a),e=d.offset(),g=parseInt(c.curCSS(a,"top",true),10)||0,h=parseInt(c.curCSS(a,"left",true),10)||0;e={top:b.top-e.top+g,left:b.left-e.left+h};"using"in b?b.using.call(a,e):d.css(e)};c.fn.offset=function(a){var b=this[0];if(!b||!b.ownerDocument)return null;if(a)return this.each(function(){c.offset.setOffset(this,a)});return q.call(this)}}})(jQuery); -;/* - * jQuery UI Autocomplete 1.8.2 - * - * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT (MIT-LICENSE.txt) - * and GPL (GPL-LICENSE.txt) licenses. - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function(e){e.widget("ui.autocomplete",{options:{minLength:1,delay:300},_create:function(){var a=this,c=this.element[0].ownerDocument;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(d){var b=e.ui.keyCode;switch(d.keyCode){case b.PAGE_UP:a._move("previousPage",d);break;case b.PAGE_DOWN:a._move("nextPage",d);break;case b.UP:a._move("previous",d);d.preventDefault(); -break;case b.DOWN:a._move("next",d);d.preventDefault();break;case b.ENTER:case b.NUMPAD_ENTER:a.menu.active&&d.preventDefault();case b.TAB:if(!a.menu.active)return;a.menu.select(d);break;case b.ESCAPE:a.element.val(a.term);a.close(d);break;case b.LEFT:case b.RIGHT:case b.SHIFT:case b.CONTROL:case b.ALT:case b.COMMAND:case b.COMMAND_RIGHT:case b.INSERT:case b.CAPS_LOCK:case b.END:case b.HOME:break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){a.search(null,d)},a.options.delay); -break}}).bind("focus.autocomplete",function(){a.selectedItem=null;a.previous=a.element.val()}).bind("blur.autocomplete",function(d){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(d);a._change(d)},150)});this._initSource();this.response=function(){return a._response.apply(a,arguments)};this.menu=e("
    ").addClass("ui-autocomplete").appendTo("body",c).mousedown(function(){setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(d,b){b=b.item.data("item.autocomplete"); -false!==a._trigger("focus",null,{item:b})&&/^key/.test(d.originalEvent.type)&&a.element.val(b.value)},selected:function(d,b){b=b.item.data("item.autocomplete");false!==a._trigger("select",d,{item:b})&&a.element.val(b.value);a.close(d);d=a.previous;if(a.element[0]!==c.activeElement){a.element.focus();a.previous=d}a.selectedItem=b},blur:function(){a.menu.element.is(":visible")&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");e.fn.bgiframe&&this.menu.element.bgiframe()}, -destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();e.Widget.prototype.destroy.call(this)},_setOption:function(a){e.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource()},_initSource:function(){var a,c;if(e.isArray(this.options.source)){a=this.options.source;this.source=function(d,b){b(e.ui.autocomplete.filter(a,d.term))}}else if(typeof this.options.source=== -"string"){c=this.options.source;this.source=function(d,b){e.getJSON(c,d,b)}}else this.source=this.options.source},search:function(a,c){a=a!=null?a:this.element.val();if(a.length").data("item.autocomplete", -c).append(""+c.label+"").appendTo(a)},_move:function(a,c){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](c);else this.search(null,c)},widget:function(){return this.menu.element}});e.extend(e.ui.autocomplete,{escapeRegex:function(a){return a.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")},filter:function(a,c){var d=new RegExp(e.ui.autocomplete.escapeRegex(c), -"i");return e.grep(a,function(b){return d.test(b.label||b.value||b)})}})})(jQuery); -(function(e){e.widget("ui.menu",{_create:function(){var a=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(c){if(e(c.target).closest(".ui-menu-item a").length){c.preventDefault();a.select(c)}});this.refresh()},refresh:function(){var a=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", --1).mouseenter(function(c){a.activate(c,e(this).parent())}).mouseleave(function(){a.deactivate()})},activate:function(a,c){this.deactivate();if(this.hasScroll()){var d=c.offset().top-this.element.offset().top,b=this.element.attr("scrollTop"),f=this.element.height();if(d<0)this.element.attr("scrollTop",b+d);else d>f&&this.element.attr("scrollTop",b+d-f+c.height())}this.active=c.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",a,{item:c})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); -this._trigger("blur");this.active=null}},next:function(a){this.move("next",".ui-menu-item:first",a)},previous:function(a){this.move("prev",".ui-menu-item:last",a)},first:function(){return this.active&&!this.active.prev().length},last:function(){return this.active&&!this.active.next().length},move:function(a,c,d){if(this.active){a=this.active[a+"All"](".ui-menu-item").eq(0);a.length?this.activate(d,a):this.activate(d,this.element.children(c))}else this.activate(d,this.element.children(c))},nextPage:function(a){if(this.hasScroll())if(!this.active|| -this.last())this.activate(a,this.element.children(":first"));else{var c=this.active.offset().top,d=this.element.height(),b=this.element.children("li").filter(function(){var f=e(this).offset().top-c-d+e(this).height();return f<10&&f>-10});b.length||(b=this.element.children(":last"));this.activate(a,b)}else this.activate(a,this.element.children(!this.active||this.last()?":first":":last"))},previousPage:function(a){if(this.hasScroll())if(!this.active||this.first())this.activate(a,this.element.children(":last")); -else{var c=this.active.offset().top,d=this.element.height();result=this.element.children("li").filter(function(){var b=e(this).offset().top-c+d-e(this).height();return b<10&&b>-10});result.length||(result=this.element.children(":first"));this.activate(a,result)}else this.activate(a,this.element.children(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()').insertAfter($(this)); - var choicesList = $('
      ').appendTo(container).css({ - width: 200, float: 'left', minHeight: 200, backgroundColor: '#eee', margin: 0, padding: 0 - }); - var valuesList = $('
        ').appendTo(container).css({ - width: 200, float: 'left', minHeight: 200, backgroundColor: '#eee', margin: 0, padding: 0 - }); - var choiceIds = []; - $.each(settings.choices, function() { - choiceIds.push('' + this.id); - }); - - function createItem(hash) { - return $('
      1. ' + hash.name + '
      2. ').css({ - backgroundColor: '#cff', - display: 'block', - border: '1px solid #cdd', - padding: 2, - margin: 0 - }).data('obj-id', hash.id); - } - - $.each(settings.choices, function() { - if ($.inArray('' + this.id, values) == -1) { - choicesList.append(createItem(this)); - } - }); - - $.each(values, function() { - var index = $.inArray('' + this, choiceIds); // Why this[0]? - if (index != -1) { - valuesList.append(createItem(settings.choices[index])); - } - }); - - choicesList.sortable({ - connectWith: '.connectedSortable' - }).disableSelection(); - - valuesList.sortable({ - connectWith: '.connectedSortable', - update: function() { - values = []; - $('li', valuesList).each(function(index) { - values.push($(this).data('obj-id')); - console.log($(this).data('obj-id')); - }); - console.log('update', values.join(','), input); - input.val(values.join(',')); - } - }).disableSelection(); - }; -})(jQuery); diff --git a/apps/wolnelektury_core/static/js/progressSpin.min.js b/apps/wolnelektury_core/static/js/progressSpin.min.js deleted file mode 100644 index f7620a200..000000000 --- a/apps/wolnelektury_core/static/js/progressSpin.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(e){e.fn.progressSpin=function(t){function f(e,t){var i=1-t;var s=Raphael.getRGB(n.activeColor);var o=Raphael.getRGB(n.fillColor);var u=Math.floor(s.r*t+o.r*i);var a=Math.floor(s.g*t+o.g*i);var f=Math.floor(s.b*t+o.b*i);var l=Raphael.rgb(u,a,f);r[e].attr("fill",l)}function l(e){e=e%12;if(e<0){e+=12}return e}if(this.getOptions){return this}var n=e.extend({},e.fn.progressSpin.defaults,t);var r=[];var i=false;var s=null;var o=0;var u=null;var a=this;this.getOptions=function(){return n};this.getVisible=function(){return i};this.getAnimating=function(){return s!=null};this.getCurrentStep=function(){return o};this.setCurrentStep=function(e){if(this.getAnimating()){this.stop(false);o=l(e);this.start()}else{o=l(e)}};this.start=function(){if(this.getAnimating()){}else{this.show();f(o,1);var e=1/(n.tailCount+1);var t=0;var r=n.tailCount;s=setInterval(function(){if(t @@ -152,11 +153,11 @@ {% compressed_js "base" %} - {{ piwik_tag|safe }} + {% tracking_code %} {% block extrabody %} {% endblock %} - + diff --git a/requirements.txt b/requirements.txt index f4de6b937..143f40eb9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ --find-links=http://www.pythonware.com/products/pil/ # django -Django>=1.5,<1.6 +Django>=1.6,<1.7 fnpdjango>=0.1.8,<0.2 South>=0.7 # migrations for django django-pipeline>=1.2.24,<1.3 @@ -11,6 +11,7 @@ django-maintenancemode>=0.10 django-piston>=0.2.2.1,<0.2.3 jsonfield>=0.9.20 django-picklefield +django-modeltranslation #django-allauth<0.10 with migration fix -e git+git://github.com/rczajka/django-allauth.git@4ecda71b81f9311dea4febe1d2d0105f23c642c7#egg=django-allauth @@ -24,7 +25,7 @@ django-honeypot django-uni-form python-memcached -piwik +django-piwik python-fb # Feedparser diff --git a/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index 8d7c00f82..c40bb366b 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -33,7 +33,6 @@ MIDDLEWARE_CLASSES = [ 'django.middleware.doc.XViewMiddleware', 'pagination.middleware.PaginationMiddleware', 'django.middleware.locale.LocaleMiddleware', - 'piwik.django.middleware.PiwikMiddleware', 'maintenancemode.middleware.MaintenanceModeMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', @@ -86,7 +85,7 @@ INSTALLED_APPS_CONTRIB = [ 'pagination', 'pipeline', 'piston', - 'piwik.django', + 'piwik', #'rosetta', 'south', 'sorl.thumbnail', diff --git a/wolnelektury/settings/contrib.py b/wolnelektury/settings/contrib.py index 04b0bd944..5ecf7d891 100644 --- a/wolnelektury/settings/contrib.py +++ b/wolnelektury/settings/contrib.py @@ -1,7 +1,10 @@ HONEYPOT_FIELD_NAME = 'miut' PAGINATION_INVALID_PAGE_RAISES_404 = True THUMBNAIL_QUALITY = 95 -TRANSLATION_REGISTRY = "wolnelektury.translation" + +MODELTRANSLATION_TRANSLATION_FILES = ["wolnelektury.translation"] +MODELTRANSLATION_DEFAULT_LANGUAGE = 'pl' +MODELTRANSLATION_PREPOPULATE_LANGUAGE = 'pl' SOUTH_MIGRATION_MODULES = { 'getpaid' : 'wolnelektury.migrations.getpaid', @@ -9,3 +12,7 @@ SOUTH_MIGRATION_MODULES = { } GETPAID_ORDER_DESCRIPTION = "{% load funding_tags %}{{ order|sanitize_payment_title }}" + +PIWIK_URL = '' +PIWIK_SITE_ID = 0 +PIWIK_TOKEN = '' diff --git a/wolnelektury/settings/static.py b/wolnelektury/settings/static.py index 472b2e978..45bd8d668 100644 --- a/wolnelektury/settings/static.py +++ b/wolnelektury/settings/static.py @@ -72,15 +72,15 @@ PIPELINE_CSS = { PIPELINE_JS = { 'base': { 'source_filenames': ( - 'js/jquery.cycle.min.js', - 'js/jquery.jqmodal.js', - 'js/jquery.form.js', - 'js/jquery.countdown.js', 'js/jquery.countdown-pl.js', - 'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js', - 'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js', - 'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js', + 'js/contrib/jquery.cycle.min.js', + 'js/contrib/jquery.jqmodal.js', + 'js/contrib/jquery.form.js', + 'js/contrib/jquery.countdown.js', 'js/contrib/jquery.countdown-pl.js', + 'js/contrib/jquery.countdown-de.js', 'js/contrib/jquery.countdown-uk.js', + 'js/contrib/jquery.countdown-es.js', 'js/contrib/jquery.countdown-lt.js', + 'js/contrib/jquery.countdown-ru.js', 'js/contrib/jquery.countdown-fr.js', - 'js/jquery-ui-1.8.16.custom.min.js', + 'js/contrib/jquery-ui-1.8.16.custom.min.js', 'js/locale.js', 'js/dialogs.js', @@ -105,36 +105,36 @@ PIPELINE_JS = { }, 'book': { 'source_filenames': [ - 'js/jquery.eventdelegation.js', - 'js/jquery.scrollto.js', - 'js/jquery.highlightfade.js', + 'js/contrib/jquery.eventdelegation.js', + 'js/contrib/jquery.scrollto.js', + 'js/contrib/jquery.highlightfade.js', 'js/book_text/other.js', 'js/book.js', - 'js/raphael-min.js', - 'js/progressSpin.min.js', + 'js/contrib/raphael-min.js', + 'js/contrib/progressSpin.min.js', 'js/picture.js', ], 'output_filename': 'js/book.min.js', }, 'book_text': { 'source_filenames': [ - 'js/jquery.form.js', - 'js/jquery.jqmodal.js', + 'js/contrib/jquery.form.js', + 'js/contrib/jquery.jqmodal.js', 'js/book_text/*.js', 'js/locale.js', 'js/dialogs.js', - 'js/jquery.highlightfade.js', - 'js/raphael-min.js', + 'js/contrib/jquery.highlightfade.js', + 'js/contrib/raphael-min.js', 'player/openplayer.js', - 'js/progressSpin.min.js', + 'js/contrib/progressSpin.min.js', 'js/picture.js', ], 'output_filename': 'js/book_text.js', }, 'book_ie': { - 'source_filenames': ('js/ierange-m2.js',), + 'source_filenames': ('js/contrib/ierange-m2.js',), 'output_filename': 'js/book_ie.min.js', } diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index 88f951a34..8adcb7a8c 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -4,7 +4,7 @@ # import os -from django.conf.urls.defaults import * +from django.conf.urls import include, patterns, url from django.conf import settings from django.contrib import admin from django.views.generic import RedirectView -- 2.20.1