From: Radek Czajka Date: Mon, 5 Nov 2012 09:58:42 +0000 (+0100) Subject: move some packages outside X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/ba57de388912d94b434e186f05caabd111541c60 move some packages outside --- diff --git a/fnpdjango/__init__.py b/fnpdjango/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnpdjango/locale/pl/LC_MESSAGES/django.mo b/fnpdjango/locale/pl/LC_MESSAGES/django.mo deleted file mode 100644 index 6e5d1fc..0000000 Binary files a/fnpdjango/locale/pl/LC_MESSAGES/django.mo and /dev/null differ diff --git a/fnpdjango/locale/pl/LC_MESSAGES/django.po b/fnpdjango/locale/pl/LC_MESSAGES/django.po deleted file mode 100644 index b43c1ce..0000000 --- a/fnpdjango/locale/pl/LC_MESSAGES/django.po +++ /dev/null @@ -1,47 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-10 14:32+0200\n" -"PO-Revision-Date: 2012-10-10 14:33+0100\n" -"Last-Translator: Radek Czajka \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" - -#: templates/fnpdjango/share.html:5 -#: templates/fnpdjango/share.html.py:7 -msgid "Share on Facebook" -msgstr "Podziel się na Facebooku" - -#: templates/fnpdjango/share.html:10 -#: templates/fnpdjango/share.html.py:12 -msgid "Share on Google+" -msgstr "Podziel się na Google+" - -#: templates/fnpdjango/share.html:15 -#: templates/fnpdjango/share.html.py:17 -msgid "Share on Twitter" -msgstr "Podziel się na Twitterze" - -#: templates/fnpdjango/share.html:20 -#: templates/fnpdjango/share.html.py:22 -msgid "Share on NK.pl" -msgstr "Podziel się na NK.pl" - -#: templates/fnpdjango/prevnext/next.html:13 -msgid "next" -msgstr "następne" - -#: templates/fnpdjango/prevnext/previous.html:13 -msgid "previous" -msgstr "poprzednie" - diff --git a/fnpdjango/middleware.py b/fnpdjango/middleware.py deleted file mode 100644 index 21de872..0000000 --- a/fnpdjango/middleware.py +++ /dev/null @@ -1,31 +0,0 @@ -from django.utils import translation -from django.conf import settings -from django.http import Http404 - - -class SetRemoteAddrFromXRealIP(object): - """Sets REMOTE_ADDR from the X-Real-IP header, as set by Nginx.""" - def process_request(self, request): - try: - request.META['REMOTE_ADDR'] = request.META['HTTP_X_REAL_IP'] - except KeyError: - return None - - -class URLLocaleMiddleware(object): - """Decides which translation to use, based on path only.""" - - def process_request(self, request): - language = translation.get_language_from_path(request.path_info) - if language == settings.LANGUAGE_CODE: - raise Http404 - if language: - translation.activate(language) - request.LANGUAGE_CODE = translation.get_language() - - def process_response(self, request, response): - language = translation.get_language() - translation.deactivate() - if 'Content-Language' not in response: - response['Content-Language'] = language - return response diff --git a/fnpdjango/models.py b/fnpdjango/models.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnpdjango/templates/fnpdjango/lang_switcher.html b/fnpdjango/templates/fnpdjango/lang_switcher.html deleted file mode 100755 index 9b725ac..0000000 --- a/fnpdjango/templates/fnpdjango/lang_switcher.html +++ /dev/null @@ -1,6 +0,0 @@ -{% load i18n fnp_lang %} -{% for lc, ln in languages %} - {% if lc != request.LANGUAGE_CODE %} - {{ lc }} - {% endif %} -{% endfor %} \ No newline at end of file diff --git a/fnpdjango/templates/fnpdjango/prevnext/next.html b/fnpdjango/templates/fnpdjango/prevnext/next.html deleted file mode 100755 index 928011f..0000000 --- a/fnpdjango/templates/fnpdjango/prevnext/next.html +++ /dev/null @@ -1,16 +0,0 @@ -{% if number or url %} - {% load i18n %} - - {% if title %} - {{ title }} - {% else %} - {% trans "next" %} - {% endif %} - -{% endif %} \ No newline at end of file diff --git a/fnpdjango/templates/fnpdjango/prevnext/previous.html b/fnpdjango/templates/fnpdjango/prevnext/previous.html deleted file mode 100755 index 88a656b..0000000 --- a/fnpdjango/templates/fnpdjango/prevnext/previous.html +++ /dev/null @@ -1,16 +0,0 @@ -{% if number or url %} - {% load i18n %} - - {% if title %} - {{ title }} - {% else %} - {% trans "previous" %} - {% endif %} - -{% endif %} \ No newline at end of file diff --git a/fnpdjango/templates/fnpdjango/prevnext/prevnext.html b/fnpdjango/templates/fnpdjango/prevnext/prevnext.html deleted file mode 100755 index fd3f9b3..0000000 --- a/fnpdjango/templates/fnpdjango/prevnext/prevnext.html +++ /dev/null @@ -1,5 +0,0 @@ -{% load fnp_prevnext %} -

-{% next_page %} -{% previous_page %} -

\ No newline at end of file diff --git a/fnpdjango/templates/fnpdjango/share.html b/fnpdjango/templates/fnpdjango/share.html deleted file mode 100755 index c42e81b..0000000 --- a/fnpdjango/templates/fnpdjango/share.html +++ /dev/null @@ -1,35 +0,0 @@ -{% load i18n fnp_common static %} -{% with encoded_url=url|build_absolute_uri:request|urlencode encoded_desc=description|urlencode %} - - - {% trans 'Share on Google+' %} - - - {% trans 'Share on NK.pl' %} -{% comment %} - - {% trans 'Share on Diaspora' %} - - {% trans 'Share on Blip.pl' %} -{% endcomment %} -{% endwith %} \ No newline at end of file diff --git a/fnpdjango/templatetags/__init__.py b/fnpdjango/templatetags/__init__.py deleted file mode 100755 index e69de29..0000000 diff --git a/fnpdjango/templatetags/fnp_common.py b/fnpdjango/templatetags/fnp_common.py deleted file mode 100755 index ccaf03b..0000000 --- a/fnpdjango/templatetags/fnp_common.py +++ /dev/null @@ -1,7 +0,0 @@ -from django import template -register = template.Library() - - -@register.filter -def build_absolute_uri(uri, request): - return request.build_absolute_uri(uri) diff --git a/fnpdjango/templatetags/fnp_lang.py b/fnpdjango/templatetags/fnp_lang.py deleted file mode 100755 index 006faec..0000000 --- a/fnpdjango/templatetags/fnp_lang.py +++ /dev/null @@ -1,48 +0,0 @@ -from django.conf import settings -from django.core.urlresolvers import resolve, reverse, Resolver404 -from django import template -from django.utils import translation -from ..utils.views import get_current_object - -register = template.Library() - - -@register.inclusion_tag('fnpdjango/lang_switcher.html', takes_context=True) -def lang_switcher(context): - """Context-aware language switcher. - - Use ..utils.views.set_current_object to provide the context. - """ - request = context['request'] - obj = get_current_object(request) - languages = settings.LANGUAGES - if hasattr(obj, 'get_available_languages'): - available_languages = set(obj.get_available_languages()) - languages = [lang for lang in languages if lang[0] in available_languages] - return { - 'request': request, - 'languages': languages, - } - - -@register.filter -def get_here_url(request, lang): - obj = get_current_object(request, for_url=True) - if hasattr(obj, 'get_absolute_url'): - with translation.override(lang): - url = obj.get_absolute_url() - else: - try: - match = resolve(request.get_full_path()) - except Resolver404: - match = resolve('/') - view = match.url_name - if view is None: - view = match.func - if lang is None: - lang = translation.get_language() - with translation.override(lang): - url = reverse(view, args=match.args, kwargs=match.kwargs) - return url - - diff --git a/fnpdjango/templatetags/fnp_markup.py b/fnpdjango/templatetags/fnp_markup.py deleted file mode 100755 index 050486a..0000000 --- a/fnpdjango/templatetags/fnp_markup.py +++ /dev/null @@ -1,14 +0,0 @@ -from django import template -from django.utils.safestring import mark_safe -from ..utils.text import textilepl - -register = template.Library() - - -@register.filter -def textile_pl(node): - return mark_safe(textile.textile_pl(node)) - -@register.filter -def textile_restricted_pl(node): - return mark_safe(textile.textile_restricted_pl(node)) diff --git a/fnpdjango/templatetags/fnp_prevnext.py b/fnpdjango/templatetags/fnp_prevnext.py deleted file mode 100755 index 4cfbb08..0000000 --- a/fnpdjango/templatetags/fnp_prevnext.py +++ /dev/null @@ -1,27 +0,0 @@ -from django.template import Library - -register = Library() - - -@register.inclusion_tag('fnpdjango/prevnext/previous.html', takes_context=True) -def previous_page(context, fallback=None, fallback_title=None): - current = context['page_obj'].number - if current > 1: - return {'number': current - 1, 'title': None, 'url': None} - else: - return {'number': None, 'title': fallback_title, 'url': fallback} - - -@register.inclusion_tag('fnpdjango/prevnext/next.html', takes_context=True) -def next_page(context, fallback=None, fallback_title=None): - current = context['page_obj'].number - page_range = context['paginator'].page_range - if current < page_range[-1]: - return {'number': current + 1, 'title': None, 'url': None} - else: - return {'number': None, 'title': fallback_title, 'url': fallback} - - -@register.inclusion_tag('fnpdjango/prevnext/prevnext.html', takes_context=True) -def prevnext(context): - return context diff --git a/fnpdjango/templatetags/fnp_share.py b/fnpdjango/templatetags/fnp_share.py deleted file mode 100755 index 3af9447..0000000 --- a/fnpdjango/templatetags/fnp_share.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.template import Library - -register = Library() - - -@register.inclusion_tag('fnpdjango/share.html', takes_context=True) -def share(context, url, description, iconset=""): - return { - 'url': url, - 'description': description, - 'iconset': iconset, - 'request': context['request'], - } diff --git a/fnpdjango/utils/__init__.py b/fnpdjango/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/fnpdjango/utils/app.py b/fnpdjango/utils/app.py deleted file mode 100755 index 795e01d..0000000 --- a/fnpdjango/utils/app.py +++ /dev/null @@ -1,30 +0,0 @@ -""" -Basic utilities for applications. -""" - - -from django.conf import settings - - -class AppSettings(object): - """Allows specyfying custom settings for an app, with default values. - - Just subclass, set some properties and instantiate with a prefix. - Getting a SETTING from an instance will check for prefix_SETTING - in project settings if set, else take the default. The value will be - then filtered through _more_SETTING method, if there is one. - - """ - def __init__(self, prefix): - self._prefix = prefix - - def __getattribute__(self, name): - if name.startswith('_'): - return object.__getattribute__(self, name) - value = getattr(settings, - "%s_%s" % (self._prefix, name), - object.__getattribute__(self, name)) - more = "_more_%s" % name - if hasattr(self, more): - value = getattr(self, more)(value) - return value diff --git a/fnpdjango/utils/models/__init__.py b/fnpdjango/utils/models/__init__.py deleted file mode 100644 index 6c6e620..0000000 --- a/fnpdjango/utils/models/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -""" -Utilities for Django models. -""" - -from django.utils.translation import string_concat - - -def filtered_model(name, model, field, value, verbose_extra=None): - """Creates a proxy model filtering objects by a field.""" - verbose_extra = verbose_extra or value - class Meta: - proxy = True - app_label = model._meta.app_label - verbose_name = string_concat(model._meta.verbose_name, - ': ', verbose_extra) - verbose_name_plural = string_concat(model._meta.verbose_name_plural, - ': ', verbose_extra) - - def save(self, *args, **kwargs): - if not getattr(self, field): - setattr(self, field, value) - return model.save(self, *args, **kwargs) - - attrs = {'__module__': '', 'Meta': Meta, 'save': save} - return type(name, (model,), attrs) diff --git a/fnpdjango/utils/models/translation.py b/fnpdjango/utils/models/translation.py deleted file mode 100644 index dd1d515..0000000 --- a/fnpdjango/utils/models/translation.py +++ /dev/null @@ -1,57 +0,0 @@ -""" -Utilities for creating multilingual fields in your apps. -""" - -from copy import copy -from django.conf import settings -from django.utils.translation import get_language, string_concat - - -def field_getter(name): - @property - def getter(self): - val = getattr(self, "%s_%s" % (name, get_language()), None) - if not val: - val = getattr(self, "%s_%s" % (name, settings.LANGUAGE_CODE)) - return val - return getter - - -def add_translatable(model, fields, languages=None): - """Adds some translatable fields to a model, and a getter.""" - if languages is None: - languages = settings.LANGUAGES - for name, field in fields.items(): - for lang_code, lang_name in languages: - new_field = copy(field) - if field.verbose_name: - new_field.verbose_name = string_concat(field.verbose_name, ' [%s]' % lang_code) - new_field.contribute_to_class(model, "%s_%s" % (name, lang_code)) - setattr(model, name, field_getter(name)) - # add setter? - - -def add_translatable_index(index_class, fields, languages=None): - """Adds some translatable fields to a search index.""" - if languages is None: - languages = settings.LANGUAGES - for name, field in fields.items(): - for lang_code, lang_name in languages: - new_field = copy(field) - fname = "%s_%s" % (name, lang_code) - new_field.index_fieldname = new_field.index_fieldname \ - and "%s_%s" % (new_field.index_fieldname, lang_code) \ - or fname - new_field.model_attr = new_field.model_attr \ - and "%s_%s" % (new_field.model_attr, lang_code) \ - or fname - setattr(index_class, fname, new_field) - index_class.fields[fname] = new_field - - -def translated_fields(field_names, languages=settings.LANGUAGES): - """Generate a tuple of field names in translated versions.""" - return tuple("%s_%s" % (field_name, lang_code) - for field_name in field_names - for lang_code, lang_name in languages - ) diff --git a/fnpdjango/utils/settings.py b/fnpdjango/utils/settings.py deleted file mode 100644 index 39b0a25..0000000 --- a/fnpdjango/utils/settings.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -Utilities for global settings. -""" - - -class LazyUGettextLazy(object): - """You can use it to internationalize strings in settings. - - Just import this class as gettext. - """ - _ = lambda s: s - real = False - - def __init__(self, text): - self.text = text - - def __unicode__(self): - if not self.real: - from django.utils.translation import ugettext_lazy - LazyUGettextLazy._ = staticmethod(ugettext_lazy) - LazyUGettextLazy.real = True - return unicode(self._(self.text)) - - diff --git a/fnpdjango/utils/text/__init__.py b/fnpdjango/utils/text/__init__.py deleted file mode 100644 index e9aecbb..0000000 --- a/fnpdjango/utils/text/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -""" -Text utilities. -""" \ No newline at end of file diff --git a/fnpdjango/utils/text/slughifi.py b/fnpdjango/utils/text/slughifi.py deleted file mode 100644 index fe5c9e3..0000000 --- a/fnpdjango/utils/text/slughifi.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -import re -from types import UnicodeType - -from django.template.defaultfilters import slugify - -# default unicode character mapping ( you may not see some chars, leave as is ) -char_map = {u'À': 'A', u'Á': 'A', u'Â': 'A', u'Ã': 'A', u'Ä': 'Ae', u'Å': 'A', u'Æ': 'A', u'Ā': 'A', u'Ą': 'A', u'Ă': 'A', u'Ç': 'C', u'Ć': 'C', u'Č': 'C', u'Ĉ': 'C', u'Ċ': 'C', u'Ď': 'D', u'Đ': 'D', u'È': 'E', u'É': 'E', u'Ê': 'E', u'Ë': 'E', u'Ē': 'E', u'Ę': 'E', u'Ě': 'E', u'Ĕ': 'E', u'Ė': 'E', u'Ĝ': 'G', u'Ğ': 'G', u'Ä ': 'G', u'Ä¢': 'G', u'Ĥ': 'H', u'Ħ': 'H', u'Ì': 'I', u'Í': 'I', u'Î': 'I', u'Ï': 'I', u'Ī': 'I', u'Ĩ': 'I', u'Ĭ': 'I', u'Ä®': 'I', u'Ä°': 'I', u'IJ': 'IJ', u'Ä´': 'J', u'Ķ': 'K', u'Ľ': 'K', u'Ĺ': 'K', u'Ä»': 'K', u'Ä¿': 'K', u'Ł': 'L', u'Ñ': 'N', u'Ń': 'N', u'Ň': 'N', u'Ņ': 'N', u'Ŋ': 'N', u'Ò': 'O', u'Ó': 'O', u'Ô': 'O', u'Õ': 'O', u'Ö': 'Oe', u'Ø': 'O', u'Ō': 'O', u'Ő': 'O', u'Ŏ': 'O', u'Œ': 'OE', u'Ŕ': 'R', u'Ř': 'R', u'Ŗ': 'R', u'Ś': 'S', u'Ş': 'S', u'Ŝ': 'S', u'Ș': 'S', u'Å ': 'S', u'Ť': 'T', u'Å¢': 'T', u'Ŧ': 'T', u'Ț': 'T', u'Ù': 'U', u'Ú': 'U', u'Û': 'U', u'Ü': 'Ue', u'Ū': 'U', u'Å®': 'U', u'Å°': 'U', u'Ŭ': 'U', u'Ũ': 'U', u'Ų': 'U', u'Å´': 'W', u'Ŷ': 'Y', u'Ÿ': 'Y', u'Ý': 'Y', u'Ź': 'Z', u'Å»': 'Z', u'Ž': 'Z', u'à': 'a', u'á': 'a', u'â': 'a', u'ã': 'a', u'ä': 'ae', u'ā': 'a', u'ą': 'a', u'ă': 'a', u'Ã¥': 'a', u'æ': 'ae', u'ç': 'c', u'ć': 'c', u'č': 'c', u'ĉ': 'c', u'ċ': 'c', u'ď': 'd', u'đ': 'd', u'è': 'e', u'é': 'e', u'ê': 'e', u'ë': 'e', u'ē': 'e', u'ę': 'e', u'ě': 'e', u'ĕ': 'e', u'ė': 'e', u'ƒ': 'f', u'ĝ': 'g', u'ğ': 'g', u'Ä¡': 'g', u'Ä£': 'g', u'Ä¥': 'h', u'ħ': 'h', u'ì': 'i', u'í': 'i', u'î': 'i', u'ï': 'i', u'Ä«': 'i', u'Ä©': 'i', u'Ä­': 'i', u'į': 'i', u'ı': 'i', u'ij': 'ij', u'ĵ': 'j', u'Ä·': 'k', u'ĸ': 'k', u'ł': 'l', u'ľ': 'l', u'ĺ': 'l', u'ļ': 'l', u'ŀ': 'l', u'ñ': 'n', u'ń': 'n', u'ň': 'n', u'ņ': 'n', u'ʼn': 'n', u'ŋ': 'n', u'ò': 'o', u'ó': 'o', u'ô': 'o', u'õ': 'o', u'ö': 'oe', u'ø': 'o', u'ō': 'o', u'ő': 'o', u'ŏ': 'o', u'œ': 'oe', u'ŕ': 'r', u'ř': 'r', u'ŗ': 'r', u'ś': 's', u'Å¡': 's', u'Å¥': 't', u'ù': 'u', u'ú': 'u', u'û': 'u', u'ü': 'ue', u'Å«': 'u', u'ů': 'u', u'ű': 'u', u'Å­': 'u', u'Å©': 'u', u'ų': 'u', u'ŵ': 'w', u'ÿ': 'y', u'ý': 'y', u'Å·': 'y', u'ż': 'z', u'ź': 'z', u'ž': 'z', u'ß': 'ss', u'Å¿': 'ss', u'Α': 'A', u'Ά': 'A', u'Ἀ': 'A', u'Ἁ': 'A', u'Ἂ': 'A', u'Ἃ': 'A', u'Ἄ': 'A', u'Ἅ': 'A', u'Ἆ': 'A', u'Ἇ': 'A', u'ᾈ': 'A', u'ᾉ': 'A', u'ᾊ': 'A', u'ᾋ': 'A', u'ᾌ': 'A', u'ᾍ': 'A', u'ᾎ': 'A', u'ᾏ': 'A', u'Ᾰ': 'A', u'á¾¹': 'A', u'Ὰ': 'A', u'á¾»': 'A', u'á¾¼': 'A', u'Β': 'B', u'Γ': 'G', u'Δ': 'D', u'Ε': 'E', u'Έ': 'E', u'Ἐ': 'E', u'Ἑ': 'E', u'Ἒ': 'E', u'Ἓ': 'E', u'Ἔ': 'E', u'Ἕ': 'E', u'Έ': 'E', u'Ὲ': 'E', u'Ζ': 'Z', u'Η': 'I', u'Ή': 'I', u'Ἠ': 'I', u'Ἡ': 'I', u'Ἢ': 'I', u'Ἣ': 'I', u'Ἤ': 'I', u'á¼­': 'I', u'á¼®': 'I', u'Ἧ': 'I', u'ᾘ': 'I', u'ᾙ': 'I', u'ᾚ': 'I', u'ᾛ': 'I', u'ᾜ': 'I', u'ᾝ': 'I', u'ᾞ': 'I', u'ᾟ': 'I', u'Ὴ': 'I', u'Ή': 'I', u'ῌ': 'I', u'Θ': 'TH', u'Ι': 'I', u'Ί': 'I', u'Ϊ': 'I', u'Ἰ': 'I', u'á¼¹': 'I', u'Ἲ': 'I', u'á¼»': 'I', u'á¼¼': 'I', u'á¼½': 'I', u'á¼¾': 'I', u'Ἷ': 'I', u'Ῐ': 'I', u'Ῑ': 'I', u'Ὶ': 'I', u'Ί': 'I', u'Κ': 'K', u'Λ': 'L', u'Μ': 'M', u'Ν': 'N', u'Ξ': 'KS', u'Ο': 'O', u'Ό': 'O', u'Ὀ': 'O', u'Ὁ': 'O', u'Ὂ': 'O', u'Ὃ': 'O', u'Ὄ': 'O', u'Ὅ': 'O', u'Ὸ': 'O', u'Ό': 'O', u'Π': 'P', u'Ρ': 'R', u'Ῥ': 'R', u'Σ': 'S', u'Τ': 'T', u'Î¥': 'Y', u'Ύ': 'Y', u'Ϋ': 'Y', u'Ὑ': 'Y', u'Ὓ': 'Y', u'Ὕ': 'Y', u'Ὗ': 'Y', u'Ῠ': 'Y', u'á¿©': 'Y', u'Ὺ': 'Y', u'á¿«': 'Y', u'Φ': 'F', u'Χ': 'X', u'Ψ': 'PS', u'Ω': 'O', u'Ώ': 'O', u'Ὠ': 'O', u'Ὡ': 'O', u'Ὢ': 'O', u'Ὣ': 'O', u'Ὤ': 'O', u'á½­': 'O', u'á½®': 'O', u'Ὧ': 'O', u'ᾨ': 'O', u'ᾩ': 'O', u'ᾪ': 'O', u'ᾫ': 'O', u'ᾬ': 'O', u'á¾­': 'O', u'á¾®': 'O', u'ᾯ': 'O', u'Ὼ': 'O', u'á¿»': 'O', u'ῼ': 'O', u'α': 'a', u'ά': 'a', u'ἀ': 'a', u'ἁ': 'a', u'ἂ': 'a', u'ἃ': 'a', u'ἄ': 'a', u'ἅ': 'a', u'ἆ': 'a', u'ἇ': 'a', u'ᾀ': 'a', u'ᾁ': 'a', u'ᾂ': 'a', u'ᾃ': 'a', u'ᾄ': 'a', u'ᾅ': 'a', u'ᾆ': 'a', u'ᾇ': 'a', u'á½°': 'a', u'á½±': 'a', u'á¾°': 'a', u'á¾±': 'a', u'á¾²': 'a', u'á¾³': 'a', u'á¾´': 'a', u'ᾶ': 'a', u'á¾·': 'a', u'β': 'b', u'γ': 'g', u'δ': 'd', u'ε': 'e', u'έ': 'e', u'ἐ': 'e', u'ἑ': 'e', u'ἒ': 'e', u'ἓ': 'e', u'ἔ': 'e', u'ἕ': 'e', u'á½²': 'e', u'á½³': 'e', u'ζ': 'z', u'η': 'i', u'ή': 'i', u'á¼ ': 'i', u'ἡ': 'i', u'á¼¢': 'i', u'á¼£': 'i', u'ἤ': 'i', u'á¼¥': 'i', u'ἦ': 'i', u'ἧ': 'i', u'ᾐ': 'i', u'ᾑ': 'i', u'ᾒ': 'i', u'ᾓ': 'i', u'ᾔ': 'i', u'ᾕ': 'i', u'ᾖ': 'i', u'ᾗ': 'i', u'á½´': 'i', u'á½µ': 'i', u'ῂ': 'i', u'ῃ': 'i', u'ῄ': 'i', u'ῆ': 'i', u'ῇ': 'i', u'θ': 'th', u'ι': 'i', u'ί': 'i', u'ϊ': 'i', u'ΐ': 'i', u'á¼°': 'i', u'á¼±': 'i', u'á¼²': 'i', u'á¼³': 'i', u'á¼´': 'i', u'á¼µ': 'i', u'ἶ': 'i', u'á¼·': 'i', u'ὶ': 'i', u'á½·': 'i', u'ῐ': 'i', u'ῑ': 'i', u'ῒ': 'i', u'ΐ': 'i', u'ῖ': 'i', u'ῗ': 'i', u'κ': 'k', u'λ': 'l', u'μ': 'm', u'ν': 'n', u'ξ': 'ks', u'ο': 'o', u'ό': 'o', u'ὀ': 'o', u'ὁ': 'o', u'ὂ': 'o', u'ὃ': 'o', u'ὄ': 'o', u'ὅ': 'o', u'ὸ': 'o', u'á½¹': 'o', u'π': 'p', u'ρ': 'r', u'ῤ': 'r', u'á¿¥': 'r', u'σ': 's', u'ς': 's', u'τ': 't', u'υ': 'y', u'ύ': 'y', u'ϋ': 'y', u'ΰ': 'y', u'ὐ': 'y', u'ὑ': 'y', u'ὒ': 'y', u'ὓ': 'y', u'ὔ': 'y', u'ὕ': 'y', u'ὖ': 'y', u'ὗ': 'y', u'ὺ': 'y', u'á½»': 'y', u'á¿ ': 'y', u'á¿¡': 'y', u'á¿¢': 'y', u'á¿£': 'y', u'ῦ': 'y', u'ῧ': 'y', u'φ': 'f', u'χ': 'x', u'ψ': 'ps', u'ω': 'o', u'ώ': 'o', u'á½ ': 'o', u'ὡ': 'o', u'á½¢': 'o', u'á½£': 'o', u'ὤ': 'o', u'á½¥': 'o', u'ὦ': 'o', u'ὧ': 'o', u'á¾ ': 'o', u'ᾡ': 'o', u'á¾¢': 'o', u'á¾£': 'o', u'ᾤ': 'o', u'á¾¥': 'o', u'ᾦ': 'o', u'ᾧ': 'o', u'á½¼': 'o', u'á½½': 'o', u'ῲ': 'o', u'ῳ': 'o', u'á¿´': 'o', u'ῶ': 'o', u'á¿·': 'o', u'¨': '', u'΅': '', u'᾿': '', u'῾': '', u'῍': '', u'῝': '', u'῎': '', u'῞': '', u'῏': '', u'῟': '', u'῀': '', u'῁': '', u'΄': '', u'á¿®': '', u'`': '', u'á¿­': '', u'ͺ': '', u'á¾½': '', u'А': 'A', u'Б': 'B', u'В': 'V', u'Г': 'G', u'Д': 'D', u'Е': 'E', u'Ё': 'E', u'Ж': 'ZH', u'З': 'Z', u'И': 'I', u'Й': 'I', u'К': 'K', u'Л': 'L', u'М': 'M', u'Н': 'N', u'О': 'O', u'П': 'P', u'Р': 'R', u'С': 'S', u'Т': 'T', u'У': 'U', u'Ф': 'F', u'Ð¥': 'KH', u'Ц': 'TS', u'Ч': 'CH', u'Ш': 'SH', u'Щ': 'SHCH', u'Ы': 'Y', u'Э': 'E', u'Ю': 'YU', u'Я': 'YA', u'а': 'A', u'б': 'B', u'в': 'V', u'г': 'G', u'д': 'D', u'е': 'E', u'ё': 'E', u'ж': 'ZH', u'з': 'Z', u'и': 'I', u'й': 'I', u'к': 'K', u'л': 'L', u'м': 'M', u'н': 'N', u'о': 'O', u'п': 'P', u'р': 'R', u'с': 'S', u'т': 'T', u'у': 'U', u'ф': 'F', u'х': 'KH', u'ц': 'TS', u'ч': 'CH', u'ш': 'SH', u'щ': 'SHCH', u'ы': 'Y', u'э': 'E', u'ю': 'YU', u'я': 'YA', u'Ъ': '', u'ъ': '', u'Ь': '', u'ь': '', u'ð': 'd', u'Ð': 'D', u'þ': 'th', u'Þ': 'TH', - u'ა': 'a', u'ბ': 'b', u'გ': 'g', u'დ': 'd', u'ე': 'e', u'ვ': 'v', u'ზ': 'z', u'თ': 't', u'ი': 'i', u'კ': 'k', u'ლ': 'l', u'მ': 'm', u'ნ': 'n', u'ო': 'o', u'პ': 'p', u'ჟ': 'zh', u'რ': 'r', u'ს': 's', u'ტ': 't', u'უ': 'u', u'ფ': 'p', u'ქ': 'k', u'ღ': 'gh', u'ყ': 'q', u'შ': 'sh', u'ჩ': 'ch', u'ც': 'ts', u'ძ': 'dz', u'წ': 'ts', u'ჭ': 'ch', u'ხ': 'kh', u'ჯ': 'j', u'ჰ': 'h' } - -def replace_char(m): - char = m.group() - if char_map.has_key(char): - return char_map[char] - else: - return char - -def slughifi(value, do_slugify=True, overwrite_char_map={}): - """ - High Fidelity slugify - slughifi.py, v 0.1 - - Examples : - - >>> text = 'C\'est déjà l\'été.' - - >>> slughifi(text) - 'cest-deja-lete' - - >>> slughifi(text, overwrite_char_map={u'\'': '-',}) - 'c-est-deja-l-ete' - - >>> slughifi(text, do_slugify=False) - "C'est deja l'ete." - - # Normal slugify removes accented characters - >>> slugify(text) - 'cest-dj-lt' - - """ - - # unicodification - if type(value) != UnicodeType: - value = unicode(value, 'utf-8', 'ignore') - - # overwrite chararcter mapping - char_map.update(overwrite_char_map) - - # try to replace chars - value = re.sub('[^a-zA-Z0-9\\s\\-]{1}', replace_char, value) - - # apply django default slugify - if do_slugify: - value = slugify(value) - - return value.encode('ascii', 'ignore') - diff --git a/fnpdjango/utils/text/textilepl.py b/fnpdjango/utils/text/textilepl.py deleted file mode 100644 index 2efde25..0000000 --- a/fnpdjango/utils/text/textilepl.py +++ /dev/null @@ -1,22 +0,0 @@ -from textile import Textile - - -class TextilePL(Textile): - """Polish version of Textile. - - Changes opening quote to Polish lower-double. - """ - glyph_defaults = [(name, repl) - for (name, repl) in Textile.glyph_defaults - if name != 'txt_quote_double_open'] - glyph_defaults.append(('txt_quote_double_open', '„')) - - -def textile_pl(text): - return TextilePL().textile(text) - - -def textile_restricted_pl(text): - return TextilePL(restricted=True, lite=True, - noimage=True, auto_link=False).textile( - text, rel='nofollow') diff --git a/fnpdjango/utils/urls.py b/fnpdjango/utils/urls.py deleted file mode 100644 index bf9747d..0000000 --- a/fnpdjango/utils/urls.py +++ /dev/null @@ -1,40 +0,0 @@ -""" -Utilities for urlconfs. -""" - -import re -from django.conf import settings -from django.conf.urls import patterns -from django.core.urlresolvers import LocaleRegexURLResolver -from django.utils.translation import get_language, string_concat - - -class MyLocaleRegexURLResolver(LocaleRegexURLResolver): - """ - A URL resolver that always matches the active language code as URL prefix. - - Rather than taking a regex argument, we just override the ``regex`` - function to always return the active language-code as regex. - """ - @property - def regex(self): - language_code = get_language() - if language_code == settings.LANGUAGE_CODE: - return re.compile('') - if language_code not in self._regex_dict: - regex_compiled = re.compile('^%s/' % language_code, re.UNICODE) - self._regex_dict[language_code] = regex_compiled - return self._regex_dict[language_code] - - -def i18n_patterns(prefix, *args): - """ - Adds the language code prefix to every URL pattern within this - function. This may only be used in the root URLconf, not in an included - URLconf. - - """ - pattern_list = patterns(prefix, *args) - if not settings.USE_I18N: - return pattern_list - return pattern_list + [MyLocaleRegexURLResolver(pattern_list)] diff --git a/fnpdjango/utils/views.py b/fnpdjango/utils/views.py deleted file mode 100644 index f2270cc..0000000 --- a/fnpdjango/utils/views.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -View-specific utilities. -""" - -from django.conf import settings -from django.http import HttpResponse, HttpResponseRedirect - - -def serve_file(url): - """Serves an URL either though Nginx's X-accel, or by redirection.""" - if settings.X_ACCEL_REDIRECT: - response = HttpResponse() - response['Content-Type'] = "" - response['X-Accel-Redirect'] = url - return response - else: - return HttpResponseRedirect(url) - - -def set_current_object(request, obj, in_url=True): - request.CURRENT_OBJECT = obj - request.CURRENT_OBJECT_IN_URL = in_url - - -def get_current_object(request, for_url=False): - if for_url and not getattr(request, 'CURRENT_OBJECT_IN_URL', True): - return None - return getattr(request, 'CURRENT_OBJECT', None) diff --git a/migdal/__init__.py b/migdal/__init__.py deleted file mode 100644 index fe90406..0000000 --- a/migdal/__init__.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -""" -Migdal (מִגְדָּל) is a multilingual blog Django app. - -Author: Radek Czajka -""" -from django.conf import settings -from fnpdjango.utils.app import AppSettings -from django.utils.translation import ugettext_lazy as _ -from migdal.helpers import EntryType - - -class Settings(AppSettings): - # Types of entries: - # (slug, commentable, on main) - TYPES = ( - EntryType('news', _('news'), commentable=True, on_main=True, promotable=True), - EntryType('publications', _('publications')), - EntryType('info', _('info')), - ) - TYPE_SUBMIT = 'news' - TAXONOMIES = ( - ('topics', _('topics')), - ('types', _('types')), - ) - LAST_COMMENTS = 5 - - MAIN_PAGE_ENTRY = None - - TYPES_DICT = None - def _more_TYPES_DICT(self, value): - return dict((t.db, t) for t in self.TYPES) - - TYPES_ON_MAIN = None - def _more_TYPES_ON_MAIN(self, value): - return tuple(t.db for t in self.TYPES if t.on_main) - - TYPES_PROMOTABLE = None - def _more_TYPES_PROMOTABLE(self, value): - return tuple(t.db for t in self.TYPES if t.promotable) - - OBLIGATORY_LANGUAGES = None - def _more_OBLIGATORY_LANGUAGES(self, value): - return value or tuple(lang for lang in settings.LANGUAGES - if lang[0] == settings.LANGUAGE_CODE) - - OPTIONAL_LANGUAGES = None - def _more_OPTIONAL_LANGUAGES(self, value): - return tuple(lang for lang in settings.LANGUAGES - if lang not in self.OBLIGATORY_LANGUAGES) - -app_settings = Settings('MIGDAL') diff --git a/migdal/admin.py b/migdal/admin.py deleted file mode 100644 index 6bdfb59..0000000 --- a/migdal/admin.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.conf import settings -from django.contrib import admin -from django.utils.translation import ugettext_lazy as _ -from migdal.models import Entry, Attachment -from migdal import app_settings -from fnpdjango.utils.models import filtered_model -from fnpdjango.utils.models.translation import translated_fields - - -class AttachmentInline(admin.TabularInline): - model = Attachment - readonly_fields = ['url'] - - -def filtered_entry_admin(typ): - class EntryAdmin(admin.ModelAdmin): - def queryset(self, request): - return self.model.objects.filter(type=typ) - - def has_add_permission(self, request): - return request.user.has_perm('migdal.add_entry') - - def has_change_permission(self, request, obj=None): - return request.user.has_perm('migdal.change_entry') - - def has_delete_permission(self, request, obj=None): - return request.user.has_perm('migdal.delete_entry') - - date_hierarchy = 'date' - readonly_fields = ('date', 'changed_at') + \ - translated_fields(('published_at',)) - _promo_if_necessary = ('promo',) if typ.promotable else () - - fieldsets = ( - (None, { - 'fields': _promo_if_necessary + ( - 'author', 'author_email', 'image', 'date', 'changed_at') - }), - ) + tuple( - (ln, {'fields': ( - ('published_%s' % lc), - 'published_at_%s' % lc, - 'title_%s' % lc, - 'slug_%s' % lc, - 'lead_%s' % lc, - 'body_%s' % lc, - )}) - for lc, ln in app_settings.OBLIGATORY_LANGUAGES - ) + tuple( - (ln, {'fields': ( - ('needed_%s' % lc, 'published_%s' % lc), - 'published_at_%s' % lc, - 'title_%s' % lc, - 'slug_%s' % lc, - 'lead_%s' % lc, - 'body_%s' % lc, - )}) - for lc, ln in app_settings.OPTIONAL_LANGUAGES - ) - - if typ.categorized: - fieldsets += ( - (_('Categories'), {'fields': ('categories',)}), - ) - prepopulated_fields = dict([ - ("slug_%s" % lang_code, ("title_%s" % lang_code,)) - for lang_code, lang_name in settings.LANGUAGES - ]) - - list_display = translated_fields(('title',), - app_settings.OBLIGATORY_LANGUAGES) + \ - ('date', 'author') + \ - _promo_if_necessary + \ - translated_fields(('published_at',)) + \ - translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES) - list_filter = _promo_if_necessary + \ - translated_fields(('published',)) + \ - translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES) - inlines = (AttachmentInline,) - search_fields = ('title_pl', 'title_en') - return EntryAdmin - - -for typ in app_settings.TYPES: - newmodel = filtered_model("Entry_%s" % typ.db, Entry, 'type', typ.db, typ.slug) - admin.site.register(newmodel, filtered_entry_admin(typ)) - - -if app_settings.TAXONOMIES: - from migdal.models import Category - - class CategoryAdmin(admin.ModelAdmin): - list_display = translated_fields(('title', 'slug')) + ('taxonomy',) - prepopulated_fields = dict([ - ("slug_%s" % lang_code, ("title_%s" % lang_code,)) - for lang_code, lang_name in settings.LANGUAGES - ]) - admin.site.register(Category, CategoryAdmin) diff --git a/migdal/api.py b/migdal/api.py deleted file mode 100644 index d4f031e..0000000 --- a/migdal/api.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from itertools import chain -from migdal.models import Entry -from migdal import app_settings -from django.utils.translation import get_language - - -def entry_list(entry_type=None, category=None, promobox=False): - lang = get_language() - object_list = Entry.objects.filter(**{"published_%s" % lang: True} - ).order_by('-published_at_%s' % lang) - if entry_type: - object_list = object_list.filter(type=entry_type.db) - else: - object_list = object_list.filter( - type__in=[t.db for t in app_settings.TYPES if t.on_main]) - if category: - object_list = object_list.filter(categories=category) - - if promobox: - promo = list(object_list.filter(promo=True)[:promobox]) - #object_list = object_list.exclude(pk__in=[p.pk for p in promo]) - object_list.promobox = promo - - return object_list diff --git a/migdal/feeds.py b/migdal/feeds.py deleted file mode 100644 index 33e9e0b..0000000 --- a/migdal/feeds.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.contrib.syndication.views import Feed -from django.core.urlresolvers import reverse -from django.shortcuts import get_object_or_404 -from django.utils.translation import ugettext as _, string_concat -from migdal import api -from migdal.models import Category -from migdal import app_settings - - -class EntriesFeed(Feed): - def get_object(self, request, type_db=None, category_slug=None): - lang = request.LANGUAGE_CODE - if category_slug: - category = get_object_or_404(Category, **{'slug_%s' % lang: category_slug}) - else: - category = None - if type_db: - entry_type = app_settings.TYPES_DICT[type_db] - else: - entry_type = None - return {'entry_type': entry_type, 'category': category} - - def title(self, obj): - t = "Prawo kultury, " + _("latest") + " " - if obj['entry_type']: - t += unicode(obj['entry_type'].slug) - else: - t += _("entries") - if obj['category']: - t += " " + _("in category") + " " + obj['category'].title - return t - - def link(self, obj): - if obj['category']: - return reverse('migdal_category', args=[obj['category'].slug]) - if obj['entry_type']: - return reverse('migdal_entry_list_%s' % obj['entry_type'].db) - return reverse('migdal_main') - - def items(self, obj): - return api.entry_list(**obj) - - def item_title(self, item): - return item.title - - def item_description(self, item): - return item.lead - image = item.image.url if item.image else "/static/img/square-logo.png" - return string_concat("" % image, item.lead) - - def item_pubdate(self, item): - return item.published_at diff --git a/migdal/fields.py b/migdal/fields.py deleted file mode 100755 index 843c44e..0000000 --- a/migdal/fields.py +++ /dev/null @@ -1,25 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.db import models - -class SlugNullField(models.SlugField): - description = "SlugField that stores NULL instead of blank value." - - def to_python(self, value, **kwargs): - value = super(SlugNullField, self).to_python(value, **kwargs) - return value if value is not None else u"" - - def get_prep_value(self, value, **kwargs): - value = super(SlugNullField, self).get_prep_value(value, **kwargs) - return value or None - - -try: - # check for south - from south.modelsinspector import add_introspection_rules -except ImportError: - pass -else: - add_introspection_rules([], ["^migdal\.fields\.SlugNullField"]) diff --git a/migdal/forms.py b/migdal/forms.py deleted file mode 100644 index e7d6394..0000000 --- a/migdal/forms.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django import forms -from django.utils.translation import ugettext_lazy as _, get_language -from migdal.models import Entry -from migdal import app_settings -from fnpdjango.utils.text import slughifi -from django.core.mail import mail_managers -from django import template - - -def get_submit_form(*args, **kwargs): - lang = get_language() - - class SubmitForm(forms.ModelForm): - class Meta: - model = Entry - fields = ['title_%s' % lang, 'lead_%s' % lang, - 'author', 'author_email', 'categories'] - required = ['title_%s' % lang] - - def __init__(self, *args, **kwargs): - super(SubmitForm, self).__init__(*args, **kwargs) - title = self.fields['title_%s' % lang] - title.required = True - title.label = _('Title') - lead = self.fields['lead_%s' % lang] - lead.required = True - lead.label = _('Content') - - def clean(self): - data = super(SubmitForm, self).clean() - data['type'] = app_settings.TYPE_SUBMIT - orig_slug = slughifi(data.get('title_%s' % lang, '')) - slug = orig_slug - number = 2 - while Entry.objects.filter(**{'slug_%s' % lang: slug}).exists(): - slug = "%s-%s" % (orig_slug, number) - number += 1 - data['slug_%s' % lang] = slug - self.cleaned_data = data - return data - - def save(self, *args, **kwargs): - entry = super(SubmitForm, self).save(commit=False) - # Something's wrong with markup fields, they choke on None here. - for f in 'lead_en', 'lead_pl', 'body_en', 'body_pl': - if getattr(entry, f) is None: - setattr(entry, f, '') - for f in 'slug_%s' % lang, 'type': - setattr(entry, f, self.cleaned_data[f]) - entry.save() - entry = super(SubmitForm, self).save(*args, **kwargs) - mail_managers(u"Nowy wpis", - template.loader.get_template( - 'migdal/mail/manager_new_entry.txt').render( - template.Context({'object': entry}))) - - return SubmitForm(*args, **kwargs) \ No newline at end of file diff --git a/migdal/helpers.py b/migdal/helpers.py deleted file mode 100644 index 8c06c16..0000000 --- a/migdal/helpers.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -class EntryType(object): - def __init__(self, db, slug, commentable=False, on_main=False, - promotable=False, categorized=False): - self.db = db - self.slug = slug - self.commentable = commentable - self.on_main = on_main - self.promotable = promotable - self.categorized = categorized - - def __unicode__(self): - return unicode(self.slug) diff --git a/migdal/locale/pl/LC_MESSAGES/django.mo b/migdal/locale/pl/LC_MESSAGES/django.mo deleted file mode 100644 index f222f82..0000000 Binary files a/migdal/locale/pl/LC_MESSAGES/django.mo and /dev/null differ diff --git a/migdal/locale/pl/LC_MESSAGES/django.po b/migdal/locale/pl/LC_MESSAGES/django.po deleted file mode 100644 index 8347953..0000000 --- a/migdal/locale/pl/LC_MESSAGES/django.po +++ /dev/null @@ -1,317 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -msgid "" -msgstr "" -"Project-Id-Version: django-migdal 0.1\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-04 12:58+0200\n" -"PO-Revision-Date: 2012-10-04 12:58+0100\n" -"Last-Translator: Radek Czajka \n" -"Language-Team: FNP \n" -"Language: Polish\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)\n" -"X-Poedit-Language: Polish\n" - -#: __init__.py:17 -msgid "news" -msgstr "newsy" - -#: __init__.py:18 -msgid "publications" -msgstr "publikacje" - -#: __init__.py:19 -msgid "info" -msgstr "info" - -#: __init__.py:23 -msgid "topics" -msgstr "tematy" - -#: __init__.py:24 -msgid "types" -msgstr "rodzaje" - -#: admin.py:44 -msgid "Categories" -msgstr "Kategorie" - -#: feeds.py:28 -msgid "latest" -msgstr "ostatnie" - -#: feeds.py:32 -#: models.py:56 -msgid "entries" -msgstr "wpisy" - -#: feeds.py:34 -msgid "in category" -msgstr "w kategorii" - -#: forms.py:28 -msgid "Title" -msgstr "Tytuł" - -#: forms.py:31 -msgid "Content" -msgstr "Treść" - -#: models.py:20 -msgid "taxonomy" -msgstr "taksonomia" - -#: models.py:24 -msgid "category" -msgstr "kategoria" - -#: models.py:25 -#: models.py:52 -#: urls.py:41 -#: urls.py:43 -msgid "categories" -msgstr "kategorie" - -#: models.py:45 -msgid "created at" -msgstr "data utworzenia" - -#: models.py:46 -msgid "changed at" -msgstr "data ostatniej zmiany" - -#: models.py:47 -msgid "author" -msgstr "autor" - -#: models.py:48 -msgid "author email" -msgstr "e-mail autora" - -#: models.py:49 -msgid "Used only to display gravatar and send notifications." -msgstr "Używany tylko do wyświetlenia gravatara i wysyłania powiadomień." - -#: models.py:50 -msgid "image" -msgstr "obrazek" - -#: models.py:51 -msgid "promoted" -msgstr "promowane" - -#: models.py:55 -msgid "entry" -msgstr "wpis" - -#: models.py:80 -#, python-format -msgid "Published entry should have a slug in relevant language (%s)." -msgstr "Opublikowany wpis powinien mieć slug w odpowiednim języku (%s)." - -#: models.py:99 -#, python-format -msgid "Your story has been published at %s." -msgstr "Twój wpis został opublikowany na stronie %s." - -#: models.py:105 -msgid "needed" -msgstr "potrzebne" - -#: models.py:106 -msgid "Unneeded" -msgstr "Niepotrzebne" - -#: models.py:106 -msgid "Needed" -msgstr "Potrzebne" - -#: models.py:106 -msgid "Done" -msgstr "Ukończone" - -#: models.py:112 -msgid "title" -msgstr "tytuł" - -#: models.py:113 -msgid "lead" -msgstr "lead" - -#: models.py:114 -#: models.py:116 -msgid "Use Textile syntax." -msgstr "Włączona składnia Textile." - -#: models.py:115 -msgid "body" -msgstr "treść" - -#: models.py:117 -msgid "published" -msgstr "opublikowane" - -#: models.py:118 -msgid "published at" -msgstr "data publikacji" - -#: models.py:123 -msgid "file" -msgstr "plik" - -#: models.py:141 -#, python-format -msgid "New comment under your story at %s." -msgstr "Nowy komentarz pod Twoim wpisem na stronie %s." - -#: urls.py:38 -#: urls.py:39 -msgid "submit" -msgstr "wyslij" - -#: urls.py:39 -msgid "thanks" -msgstr "dzieki" - -#: urls.py:45 -msgid "search" -msgstr "szukaj" - -#: templates/comments/form.html:3 -msgid "Add comment" -msgstr "Dodaj komentarz" - -#: templates/comments/form.html:24 -msgid "Post" -msgstr "Wyślij" - -#: templates/comments/form.html:25 -msgid "Preview" -msgstr "Podgląd" - -#: templates/comments/migdal/entry/list.html:5 -msgid "Comments" -msgstr "Komentarze" - -#: templates/comments/migdal/entry/preview.html:26 -msgid "Preview your comment" -msgstr "Podgląd komentarza" - -#: templates/migdal/entry/entry_detail.html:27 -msgid "This entry hasn't been published yet." -msgstr "Ten wpis nie został jeszcze opublikowany." - -#: templates/migdal/entry/entry_list.html:22 -msgid "Category" -msgstr "Kategoria" - -#: templates/migdal/entry/entry_list.html:55 -msgid "Submit a new story, create Culture's Right with us!" -msgstr "Dodaj nowy wpis, twórz Prawo Kultury razem z nami!" - -#: templates/migdal/entry/entry_short.html:19 -#, python-format -msgid "%(c)s comment" -msgid_plural "%(c)s comments" -msgstr[0] "%(c)s komentarz" -msgstr[1] "%(c)s komentarze" -msgstr[2] "%(c)s komentarzy" - -#: templates/migdal/entry/entry_short.html:24 -msgid "read more" -msgstr "czytaj więcej" - -#: templates/migdal/entry/submit.html:7 -msgid "Submit new story" -msgstr "Dodaj nowy wpis" - -#: templates/migdal/entry/submit.html:9 -msgid "" -"\n" -"By submitting a story here, you agree to publish it under the terms of the\n" -"Creative Commons Attribution-Share Alike\n" -"free license." -msgstr "" -"\n" -"Dodając wpis, zgadzasz się najego publikację na warunkach wolnej licencji\n" -"Creative Commons Uznanie autorstwa – Na tych samych warunkach." - -#: templates/migdal/entry/submit.html:14 -msgid "" -"Stories are moderated, so please be\n" -"patient, you'll be notified when it's published." -msgstr "Wpisy są moderowane. Bądź cierpliwy, otrzymasz powiadomienie o publikacji." - -#: templates/migdal/entry/submit.html:21 -msgid "Submit" -msgstr "Wyślij" - -#: templates/migdal/entry/submit_thanks.html:6 -msgid "Thanks for submitting" -msgstr "Dziękujemy za zgłoszenie" - -#: templates/migdal/entry/submit_thanks.html:9 -msgid "" -"\n" -"Thank you for submitting this new story, it's waiting for moderation.\n" -"If you provided an email, we'll inform you about changes in it's status\n" -"and comments.\n" -msgstr "" -"\n" -"Dziękujemy za dodanie nowego wpisu, teraz czeka on na moderację. Jeśli podano adres e-mail, będziemy Cię informowali o zmianach statusu i komentarzach\n" - -#: templates/search/search.html:9 -msgid "Search results" -msgstr "Wyniki wyszukiwania" - -#: templates/search/search.html:18 -msgid "No results found." -msgstr "Brak wyników." - -#: templates/search/search.html:25 -msgid "previous" -msgstr "poprzednie" - -#: templates/search/search.html:28 -msgid "next" -msgstr "następne" - -#: templatetags/migdal_tags.py:128 -msgid "Publications" -msgstr "Publikacje" - -#: templatetags/migdal_tags.py:129 -msgid "Events" -msgstr "Wydarzenia" - -#: templatetags/migdal_tags.py:131 -msgid "Positions" -msgstr "Stanowiska" - -#~ msgid "Please correct the error below" - -#~ msgid_plural "Please correct the errors below" -#~ msgstr[0] "Proszę poprawić poniższy błąd" -#~ msgstr[1] "Proszę poprawić poniższe błędy" -#~ msgstr[2] "Proszę poprawić poniższe błędy" - -#~ msgid "and" -#~ msgstr "i" - -#~ msgid "Post your comment" -#~ msgstr "Wyślij komentarz" - -#~ msgid "or make changes" -#~ msgstr "lub zmień" - -#~ msgid "Latest news" -#~ msgstr "Ostatnie newsy" - -#~ msgid "Submit a new story." -#~ msgstr "Przyślij nowego newsa." diff --git a/migdal/migrations/0001_initial.py b/migdal/migrations/0001_initial.py deleted file mode 100644 index 3af9e00..0000000 --- a/migdal/migrations/0001_initial.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Category' - db.create_table('migdal_category', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('slug_pl', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50)), - ('slug_en', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50)), - ('title_pl', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64, db_index=True)), - ('title_en', self.gf('django.db.models.fields.CharField')(unique=True, max_length=64, db_index=True)), - )) - db.send_create_signal('migdal', ['Category']) - - # Adding model 'Entry' - db.create_table('migdal_entry', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('type', self.gf('django.db.models.fields.CharField')(max_length=16, db_index=True)), - ('date', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, db_index=True, blank=True)), - ('author', self.gf('django.db.models.fields.CharField')(max_length=128)), - ('author_email', self.gf('django.db.models.fields.EmailField')(max_length=128, null=True, blank=True)), - ('image', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)), - ('promo', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('slug_pl', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50)), - ('title_pl', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('lead_pl', self.gf('markupfield.fields.MarkupField')(rendered_field=True)), - ('lead_pl_markup_type', self.gf('django.db.models.fields.CharField')(default='textile_pl', max_length=30)), - ('_lead_pl_rendered', self.gf('django.db.models.fields.TextField')()), - ('slug_en', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True, null=True, blank=True)), - ('title_en', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)), - ('lead_en', self.gf('markupfield.fields.MarkupField')(null=True, rendered_field=True, blank=True)), - ('needed_en', self.gf('django.db.models.fields.CharField')(default='n', max_length=1, db_index=True)), - ('lead_en_markup_type', self.gf('django.db.models.fields.CharField')(default='textile_pl', max_length=30, blank=True)), - ('_lead_en_rendered', self.gf('django.db.models.fields.TextField')()), - ('body_pl', self.gf('markupfield.fields.MarkupField')(null=True, rendered_field=True, blank=True)), - ('body_en', self.gf('markupfield.fields.MarkupField')(null=True, rendered_field=True, blank=True)), - ('body_pl_markup_type', self.gf('django.db.models.fields.CharField')(default='textile_pl', max_length=30, blank=True)), - ('body_en_markup_type', self.gf('django.db.models.fields.CharField')(default='textile_pl', max_length=30, blank=True)), - ('published_pl', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('published_en', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('_body_pl_rendered', self.gf('django.db.models.fields.TextField')()), - ('_body_en_rendered', self.gf('django.db.models.fields.TextField')()), - )) - db.send_create_signal('migdal', ['Entry']) - - # Adding M2M table for field categories on 'Entry' - db.create_table('migdal_entry_categories', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('entry', models.ForeignKey(orm['migdal.entry'], null=False)), - ('category', models.ForeignKey(orm['migdal.category'], null=False)) - )) - db.create_unique('migdal_entry_categories', ['entry_id', 'category_id']) - - # Adding model 'Attachment' - db.create_table('migdal_attachment', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('file', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - ('entry', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['migdal.Entry'])), - )) - db.send_create_signal('migdal', ['Attachment']) - - - def backwards(self, orm): - # Deleting model 'Category' - db.delete_table('migdal_category') - - # Deleting model 'Entry' - db.delete_table('migdal_entry') - - # Removing M2M table for field categories on 'Entry' - db.delete_table('migdal_entry_categories') - - # Deleting model 'Attachment' - db.delete_table('migdal_attachment') - - - models = { - 'migdal.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}), - 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'migdal.category': { - 'Meta': {'object_name': 'Category'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}) - }, - 'migdal.entry': { - 'Meta': {'ordering': "['-date']", 'object_name': 'Entry'}, - '_body_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}), - 'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}), - 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'lead_pl': ('markupfield.fields.MarkupField', [], {'rendered_field': 'True'}), - 'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30'}), - 'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}), - 'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) - } - } - - complete_apps = ['migdal'] \ No newline at end of file diff --git a/migdal/migrations/0002_auto__chg_field_entry_slug_pl__chg_field_entry_title_pl__chg_field_ent.py b/migdal/migrations/0002_auto__chg_field_entry_slug_pl__chg_field_entry_title_pl__chg_field_ent.py deleted file mode 100644 index 1caced4..0000000 --- a/migdal/migrations/0002_auto__chg_field_entry_slug_pl__chg_field_entry_title_pl__chg_field_ent.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- 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 'Entry.slug_pl' - db.alter_column('migdal_entry', 'slug_pl', self.gf('django.db.models.fields.SlugField')(max_length=50, unique=True, null=True)) - - # Changing field 'Entry.title_pl' - db.alter_column('migdal_entry', 'title_pl', self.gf('django.db.models.fields.CharField')(max_length=255, null=True)) - - # Changing field 'Entry.lead_pl' - db.alter_column('migdal_entry', 'lead_pl', self.gf('markupfield.fields.MarkupField')(null=True, rendered_field=True)) - - def backwards(self, orm): - - # Changing field 'Entry.slug_pl' - db.alter_column('migdal_entry', 'slug_pl', self.gf('django.db.models.fields.SlugField')(default='', max_length=50, unique=True)) - - # Changing field 'Entry.title_pl' - db.alter_column('migdal_entry', 'title_pl', self.gf('django.db.models.fields.CharField')(default='', max_length=255)) - - # Changing field 'Entry.lead_pl' - db.alter_column('migdal_entry', 'lead_pl', self.gf('markupfield.fields.MarkupField')(default='', rendered_field=True)) - - models = { - 'migdal.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}), - 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'migdal.category': { - 'Meta': {'object_name': 'Category'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}) - }, - 'migdal.entry': { - 'Meta': {'ordering': "['-date']", 'object_name': 'Entry'}, - '_body_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}), - 'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}), - 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'lead_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}), - 'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) - } - } - - complete_apps = ['migdal'] \ No newline at end of file diff --git a/migdal/migrations/0003_auto__add_field_category_taxonomy.py b/migdal/migrations/0003_auto__add_field_category_taxonomy.py deleted file mode 100644 index 7368441..0000000 --- a/migdal/migrations/0003_auto__add_field_category_taxonomy.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Category.taxonomy' - db.add_column('migdal_category', 'taxonomy', - self.gf('django.db.models.fields.CharField')(default='topics', max_length=32), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Category.taxonomy' - db.delete_column('migdal_category', 'taxonomy') - - - models = { - 'migdal.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}), - 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'migdal.category': { - 'Meta': {'object_name': 'Category'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'taxonomy': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}) - }, - 'migdal.entry': { - 'Meta': {'ordering': "['-date']", 'object_name': 'Entry'}, - '_body_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}), - 'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}), - 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'lead_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}), - 'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) - } - } - - complete_apps = ['migdal'] \ No newline at end of file diff --git a/migdal/migrations/0004_auto__chg_field_entry_slug_pl__chg_field_entry_slug_en.py b/migdal/migrations/0004_auto__chg_field_entry_slug_pl__chg_field_entry_slug_en.py deleted file mode 100644 index a546e52..0000000 --- a/migdal/migrations/0004_auto__chg_field_entry_slug_pl__chg_field_entry_slug_en.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- 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 'Entry.slug_pl' - db.alter_column('migdal_entry', 'slug_pl', self.gf('migdal.fields.SlugNullField')(max_length=50, unique=True, null=True)) - - # Changing field 'Entry.slug_en' - db.alter_column('migdal_entry', 'slug_en', self.gf('migdal.fields.SlugNullField')(max_length=50, unique=True, null=True)) - - def backwards(self, orm): - - # Changing field 'Entry.slug_pl' - db.alter_column('migdal_entry', 'slug_pl', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, null=True)) - - # Changing field 'Entry.slug_en' - db.alter_column('migdal_entry', 'slug_en', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, null=True)) - - models = { - 'migdal.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}), - 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'migdal.category': { - 'Meta': {'object_name': 'Category'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'taxonomy': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}) - }, - 'migdal.entry': { - 'Meta': {'ordering': "['-date']", 'object_name': 'Entry'}, - '_body_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}), - 'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}), - 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'lead_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}), - 'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'slug_en': ('migdal.fields.SlugNullField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'slug_pl': ('migdal.fields.SlugNullField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) - } - } - - complete_apps = ['migdal'] \ No newline at end of file diff --git a/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py b/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py deleted file mode 100644 index f8e8ee8..0000000 --- a/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py +++ /dev/null @@ -1,99 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Entry.changed_at' - db.add_column('migdal_entry', 'changed_at', - self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2000, 1, 1, 0, 0), db_index=True, blank=True), - keep_default=False) - - # Adding field 'Entry.published_at_pl' - db.add_column('migdal_entry', 'published_at_pl', - self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True), - keep_default=False) - - # Adding field 'Entry.published_at_en' - db.add_column('migdal_entry', 'published_at_en', - self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True), - keep_default=False) - - if not db.dry_run: - for entry in orm['migdal.Entry'].objects.all(): - update_info = {} - if entry.published_pl: - update_info['published_at_pl'] = entry.date - if entry.published_en: - update_info['published_at_en'] = entry.date - update_info['changed_at'] = entry.date - orm['migdal.Entry'].objects.filter(pk=entry.pk).update(**update_info) - - - def backwards(self, orm): - # Deleting field 'Entry.changed_at' - db.delete_column('migdal_entry', 'changed_at') - - # Deleting field 'Entry.published_at_pl' - db.delete_column('migdal_entry', 'published_at_pl') - - # Deleting field 'Entry.published_at_en' - db.delete_column('migdal_entry', 'published_at_en') - - - models = { - 'migdal.attachment': { - 'Meta': {'object_name': 'Attachment'}, - 'entry': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['migdal.Entry']"}), - 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'migdal.category': { - 'Meta': {'object_name': 'Category'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slug_en': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'slug_pl': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}), - 'taxonomy': ('django.db.models.fields.CharField', [], {'max_length': '32'}), - 'title_en': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64', 'db_index': 'True'}) - }, - 'migdal.entry': { - 'Meta': {'ordering': "['-date']", 'object_name': 'Entry'}, - '_body_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_body_pl_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_en_rendered': ('django.db.models.fields.TextField', [], {}), - '_lead_pl_rendered': ('django.db.models.fields.TextField', [], {}), - 'author': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'author_email': ('django.db.models.fields.EmailField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'body_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'body_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'body_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['migdal.Category']", 'null': 'True', 'blank': 'True'}), - 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), - 'date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), - 'lead_en': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_en_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'lead_pl': ('markupfield.fields.MarkupField', [], {'null': 'True', 'rendered_field': 'True', 'blank': 'True'}), - 'lead_pl_markup_type': ('django.db.models.fields.CharField', [], {'default': "'textile_pl'", 'max_length': '30', 'blank': 'True'}), - 'needed_en': ('django.db.models.fields.CharField', [], {'default': "'n'", 'max_length': '1', 'db_index': 'True'}), - 'promo': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_at_en': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'published_at_pl': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), - 'published_en': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'published_pl': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'slug_en': ('migdal.fields.SlugNullField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'slug_pl': ('migdal.fields.SlugNullField', [], {'max_length': '50', 'unique': 'True', 'null': 'True', 'blank': 'True'}), - 'title_en': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'title_pl': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '16', 'db_index': 'True'}) - } - } - - complete_apps = ['migdal'] \ No newline at end of file diff --git a/migdal/migrations/__init__.py b/migdal/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/migdal/models.py b/migdal/models.py deleted file mode 100644 index 54091e4..0000000 --- a/migdal/models.py +++ /dev/null @@ -1,145 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from datetime import datetime -from django.conf import settings -from django.contrib.sites.models import Site -from django.core.exceptions import ValidationError -from django.core.mail import send_mail -from django.db import models -from django.template import loader, Context -from django.utils.translation import get_language, ugettext_lazy as _, ugettext -from django_comments_xtd.models import XtdComment -from markupfield.fields import MarkupField -from migdal import app_settings -from fnpdjango.utils.models.translation import add_translatable -from migdal.fields import SlugNullField - -class Category(models.Model): - taxonomy = models.CharField(_('taxonomy'), max_length=32, - choices=app_settings.TAXONOMIES) - - class Meta: - verbose_name = _('category') - verbose_name_plural = _('categories') - - def __unicode__(self): - return self.title - - @models.permalink - def get_absolute_url(self): - return ('migdal_category', [self.slug]) - - -add_translatable(Category, { - 'title': models.CharField(max_length=64, unique=True, db_index=True), - 'slug': models.SlugField(unique=True, db_index=True), -}) - - -class Entry(models.Model): - type = models.CharField(max_length=16, - choices=((t.db, t.slug) for t in app_settings.TYPES), - db_index=True) - date = models.DateTimeField(_('created at'), auto_now_add=True, db_index=True) - changed_at = models.DateTimeField(_('changed at'), auto_now=True, db_index=True) - author = models.CharField(_('author'), max_length=128) - author_email = models.EmailField(_('author email'), max_length=128, null=True, blank=True, - help_text=_('Used only to display gravatar and send notifications.')) - image = models.ImageField(_('image'), upload_to='entry/image/', null=True, blank=True) - promo = models.BooleanField(_('promoted'), default=False) - categories = models.ManyToManyField(Category, null=True, blank=True, verbose_name=_('categories')) - - class Meta: - verbose_name = _('entry') - verbose_name_plural = _('entries') - ordering = ['-date'] - - def __unicode__(self): - return self.title - - def save(self, *args, **kwargs): - if self.pk is not None: - orig = type(self).objects.get(pk=self.pk) - published_now = False - for lc, ln in settings.LANGUAGES: - if (getattr(self, "published_%s" % lc) - and getattr(self, "published_at_%s" % lc) is None): - setattr(self, "published_at_%s" % lc, datetime.now()) - published_now = True - if published_now: - self.notify_author_published() - super(Entry, self).save(*args, **kwargs) - - def clean(self): - for lc, ln in settings.LANGUAGES: - if (getattr(self, "published_%s" % lc) and - not getattr(self, "slug_%s" % lc)): - raise ValidationError( - ugettext("Published entry should have a slug in relevant language (%s).") % lc) - - @models.permalink - def get_absolute_url(self): - return ('migdal_entry_%s' % self.type, [self.slug]) - - def get_type(self): - return dict(app_settings.TYPES_DICT)[self.type] - - def notify_author_published(self): - if not self.author_email: - return - site = Site.objects.get_current() - mail_text = loader.get_template('migdal/mail/published.txt').render( - Context({ - 'entry': self, - 'site': site, - })) - send_mail( - ugettext(u'Your story has been published at %s.') % site.domain, - mail_text, settings.SERVER_EMAIL, [self.author_email] - ) - - -add_translatable(Entry, languages=app_settings.OPTIONAL_LANGUAGES, fields={ - 'needed': models.CharField(_('needed'), max_length=1, db_index=True, choices=( - ('n', _('Unneeded')), ('w', _('Needed')), ('y', _('Done'))), - default='n'), -}) - -add_translatable(Entry, { - 'slug': SlugNullField(unique=True, db_index=True, null=True, blank=True), - 'title': models.CharField(_('title'), max_length=255, null=True, blank=True), - 'lead': MarkupField(_('lead'), markup_type='textile_pl', null=True, blank=True, - help_text=_('Use Textile syntax.')), - 'body': MarkupField(_('body'), markup_type='textile_pl', null=True, blank=True, - help_text=_('Use Textile syntax.')), - 'published': models.BooleanField(_('published'), default=False), - 'published_at': models.DateTimeField(_('published at'), null=True, blank=True), -}) - - -class Attachment(models.Model): - file = models.FileField(_('file'), upload_to='entry/attach/') - entry = models.ForeignKey(Entry) - - def url(self): - return self.file.url if self.file else '' - - - -def notify_new_comment(sender, instance, created, **kwargs): - if (created and isinstance(instance.content_object, Entry) and - instance.content_object.author_email): - site = Site.objects.get_current() - mail_text = loader.get_template('migdal/mail/new_comment.txt').render( - Context({ - 'comment': instance, - 'site': site, - })) - send_mail( - ugettext(u'New comment under your story at %s.') % site.domain, - mail_text, settings.SERVER_EMAIL, - [instance.content_object.author_email] - ) -models.signals.post_save.connect(notify_new_comment, sender=XtdComment) \ No newline at end of file diff --git a/migdal/readme.md b/migdal/readme.md deleted file mode 100644 index c125966..0000000 --- a/migdal/readme.md +++ /dev/null @@ -1 +0,0 @@ -Why not LocaleMiddleware? (consistent lang, url to lang) diff --git a/migdal/search_indexes.py b/migdal/search_indexes.py deleted file mode 100644 index 27169f3..0000000 --- a/migdal/search_indexes.py +++ /dev/null @@ -1,27 +0,0 @@ -import datetime -from django.conf import settings -from haystack import indexes -from fnpdjango.utils.models.translation import add_translatable_index -from migdal.models import Entry - - -class EntryIndex(indexes.RealTimeSearchIndex, indexes.Indexable): - date = indexes.DateTimeField(indexed=True, model_attr="date") - author = indexes.CharField(model_attr="author") - - def get_model(self): - return Entry - - def index_queryset(self): - """Used when the entire index for model is updated.""" - return self.get_model().objects.all() # filter(date__lte=datetime.datetime.now()) - - -add_translatable_index(EntryIndex, { - 'title': indexes.CharField(null=True), - 'lead': indexes.CharField(null=True), - 'body': indexes.CharField(null=True) - }) - - -getattr(EntryIndex, "body_%s" % settings.LANGUAGE_CODE).document = True diff --git a/migdal/templates/comments/form.html b/migdal/templates/comments/form.html deleted file mode 100755 index 341750f..0000000 --- a/migdal/templates/comments/form.html +++ /dev/null @@ -1,29 +0,0 @@ -{% load comments i18n %} -
-

{% trans "Add comment" %}

-
{% csrf_token %} - {% if next %}{% endif %} - {% for field in form %} - {% if field.is_hidden %} - {{ field }} - {% endif %} - {% endfor %} - - {% for field in form %} - {% if not field.is_hidden %} - - - {% endif %} - {% endfor %} - -
{{ field.label_tag }} - - {% if field.errors %}

{{ field.errors }}

{% endif %} - {{ field }} -
- - -
-
-
diff --git a/migdal/templates/comments/migdal/entry/list.html b/migdal/templates/comments/migdal/entry/list.html deleted file mode 100755 index 59510ee..0000000 --- a/migdal/templates/comments/migdal/entry/list.html +++ /dev/null @@ -1,26 +0,0 @@ -{% load i18n %} -{% load gravatar %} -{% load fnp_markup %} - -

{% trans "Comments" %}

-
- {% for comment in comment_list %} -
- Avatar -
-
- {% if comment.url %} - - {% endif %} - {{ comment.name }} - {% if comment.url %} - - {% endif %} -
-
{{ comment.submit_date }}
-
-
{{ comment.comment|textile_restricted_pl }}
-
- {% endfor %} -
-
\ No newline at end of file diff --git a/migdal/templates/comments/migdal/entry/preview.html b/migdal/templates/comments/migdal/entry/preview.html deleted file mode 100755 index ae3eb92..0000000 --- a/migdal/templates/comments/migdal/entry/preview.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "base.html" %} -{% load comments gravatar i18n %} -{% load migdal_tags fnp_markup %} - - -{% block "main_menu" %} - {% main_menu 'object' entry %} -{% endblock "main_menu" %} - - -{% block "body" %} - -
-
- -{% entry_begin form.target_object 1 %} -
-{{ form.target_object.body }} -
- -{% if form.target_object.get_type.commentable %} -
- - {% render_comment_list for form.target_object %} - -

{% trans "Preview your comment" %}

-
- -
- Avatar -
-
{{ form.name.value }}
-
-
{{ comment|textile_restricted_pl }}
-
-
- - {% include "comments/form.html" %} - -
-{% endif %} -
-
- -{% endblock %} diff --git a/migdal/templates/django_comments_xtd/email_followup_comment.html b/migdal/templates/django_comments_xtd/email_followup_comment.html deleted file mode 100644 index 2e5e858..0000000 --- a/migdal/templates/django_comments_xtd/email_followup_comment.html +++ /dev/null @@ -1,19 +0,0 @@ -{% load i18n %} -

{{ user_name }},

- -

Pojawił się nowy komentarz w wątku z Twoim udziałem.

- -

-{% language 'pl' %} - „{{ content_object.title }}” -{% endlanguage %} -

- -

{{ comment.name }}, {{ comment.submit_date|date:"SHORT_DATE_FORMAT" }}:

-
-{{ comment.comment }} -
- -

--
-{{ site }} -

diff --git a/migdal/templates/django_comments_xtd/email_followup_comment.txt b/migdal/templates/django_comments_xtd/email_followup_comment.txt deleted file mode 100755 index 834c60e..0000000 --- a/migdal/templates/django_comments_xtd/email_followup_comment.txt +++ /dev/null @@ -1,15 +0,0 @@ -{% load i18n %}{{ user_name }}, - -Pojawił się nowy komentarz w wątku z Twoim udziałem. - -{% language 'pl' %}„{{ content_object.title }}” -http://{{ site.domain }}{{ content_object.get_absolute_url }}{% endlanguage %} - - -{{ comment.name }}, {{ comment.submit_date|date:"SHORT_DATE_FORMAT" }}: --------- -{{ comment.comment }} - - --- -{{ site }} diff --git a/migdal/templates/migdal/categories.html b/migdal/templates/migdal/categories.html deleted file mode 100755 index 75c0805..0000000 --- a/migdal/templates/migdal/categories.html +++ /dev/null @@ -1,7 +0,0 @@ -
    - {% for cat in object_list %} -
  • - {{ cat }} -
  • - {% endfor %} -
\ No newline at end of file diff --git a/migdal/templates/migdal/entry/entry_begin.html b/migdal/templates/migdal/entry/entry_begin.html deleted file mode 100755 index 161e359..0000000 --- a/migdal/templates/migdal/entry/entry_begin.html +++ /dev/null @@ -1,33 +0,0 @@ -{% load i18n %} -{% load gravatar thumbnail %} - -Avatar -{% if detail %} -

{{ object.title }}

-{% else %} -

{{ object.title }}

-{% endif %} - -
-
{{ object.published_at }}
-
{{ object.author }}
- -
-{% for category in object.categories.all %} - {% if forloop.counter != 1 %}/{% endif %} - {{ category }} -{% endfor %} -
- -
- -{% if object.image %} - -{% endif %} -
-{{ object.lead }} -
diff --git a/migdal/templates/migdal/entry/entry_detail.html b/migdal/templates/migdal/entry/entry_detail.html deleted file mode 100755 index c19b49b..0000000 --- a/migdal/templates/migdal/entry/entry_detail.html +++ /dev/null @@ -1,52 +0,0 @@ -{% extends "base.html" %} -{% load comments i18n %} -{% load fnp_common migdal_tags fnp_share %} - - -{% block "titleextra" %}{{ entry.title }} :: {% endblock %} -{% block "ogtitle" %}{{ entry.title }}{% endblock %} -{% block "ogtype" %}article{% endblock %} -{% block "ogdescription"%}{{ entry.lead|striptags|truncatewords:10 }}{% endblock %} -{% block "ogimage" %}{% spaceless %} -{% if entry.image %} - {{ entry.image.url|build_absolute_uri:request }} -{% else %} - {{ block.super }} -{% endif %} -{% endspaceless %}{% endblock %} - - -{% block "body" %} - -{% if not entry.published %} -

{% trans "This entry hasn't been published yet." %}

-{% endif %} - -
-
- -{% entry_begin entry 1 %} -
-{{ entry.body }} -
- -
- -
- -
- -
- -{% if entry.get_type.commentable %} - {% render_comment_list for entry %} -
- {% entry_comment_form entry %} -
-{% endif %} -
-
- -{% endblock %} \ No newline at end of file diff --git a/migdal/templates/migdal/entry/entry_list.html b/migdal/templates/migdal/entry/entry_list.html deleted file mode 100755 index e144533..0000000 --- a/migdal/templates/migdal/entry/entry_list.html +++ /dev/null @@ -1,55 +0,0 @@ -{% extends "base.html" %} -{% load url from future %} -{% load i18n %} -{% load pagination_tags fnp_prevnext %} -{% load migdal_tags %} - - -{% block "body" %} - -{% if category %} -

{% trans "Category" %}: {{ category }} - -

-{% elif entry_type %} -

{{ entry_type|capfirst }} - -

-{% endif %} - -{% if object_list.promobox and request.page == 1 %} -
- - -
-
    -{% for object in object_list.promobox %} - {% entry_promobox object forloop.counter %} -{% endfor %} -
-
- -
-{% endif %} - -{% if submit %} - -{% endif %} - - -{% autopaginate object_list 10 %} -{% for object in object_list %} - {% entry_short object %} -{% endfor %} -{% prevnext %} - -{% endblock %} \ No newline at end of file diff --git a/migdal/templates/migdal/entry/entry_promobox.html b/migdal/templates/migdal/entry/entry_promobox.html deleted file mode 100755 index f68b487..0000000 --- a/migdal/templates/migdal/entry/entry_promobox.html +++ /dev/null @@ -1,30 +0,0 @@ -{% load i18n thumbnail %} - - -
  • - - - - -
    -
    -

    {{ object.title }}

    - -
    -{{ object.lead|striptags|truncatewords:8 }} -
    -
    -
    - -
    -
  • diff --git a/migdal/templates/migdal/entry/entry_short.html b/migdal/templates/migdal/entry/entry_short.html deleted file mode 100755 index 7a5eb25..0000000 --- a/migdal/templates/migdal/entry/entry_short.html +++ /dev/null @@ -1,38 +0,0 @@ -{% load i18n %} -{% load comments %} -{% load migdal_tags fnp_share %} - - -
    -
    - -{% entry_begin object %} - -
    - -
    -
    - -{% if object.get_type.commentable %} -{% get_comment_count for object as comment_count %} - -{% blocktrans count comment_count as c %}{{c}} comment{% plural %}{{c}} comments{% endblocktrans %} - -{% endif %} - -{% if object.body.raw %} - {% trans "read more" %} -{% endif %} - -
    - - -
    - - - -
    -
    -
    diff --git a/migdal/templates/migdal/entry/info/entry_begin.html b/migdal/templates/migdal/entry/info/entry_begin.html deleted file mode 100755 index 1d934bc..0000000 --- a/migdal/templates/migdal/entry/info/entry_begin.html +++ /dev/null @@ -1,22 +0,0 @@ -{% load i18n %} -{% load thumbnail %} - -{% if detail %} -

    {{ object.title }}

    -{% else %} -

    {{ object.title }}

    -{% endif %} - - -{% if object.image %} - - - -{% endif %} -
    -{{ object.lead }} -
    diff --git a/migdal/templates/migdal/entry/publications/entry_begin.html b/migdal/templates/migdal/entry/publications/entry_begin.html deleted file mode 100755 index e9eae95..0000000 --- a/migdal/templates/migdal/entry/publications/entry_begin.html +++ /dev/null @@ -1,38 +0,0 @@ -{% load i18n %} -{% load thumbnail %} - -{% if detail %} -

    {{ object.title }}

    -{% else %} -

    {{ object.title }}

    -{% endif %} - - -{% comment %} -
    -{% if request.LANGUAGE_CODE == 'pl' %} - {% if object.published_en %} - {% language 'en' %} - English version - {% endlanguage %} - {% endif %} -{% elif object.published_pl %} - {{ request.LANGUAGE_CODE }} - {% language 'pl' %} - polska wersja - {% endlanguage %} -{% endif %} -
    -{% endcomment %} - - -{% if object.image %} - -{% endif %} -
    -{{ object.lead }} -
    diff --git a/migdal/templates/migdal/entry/submit.html b/migdal/templates/migdal/entry/submit.html deleted file mode 100755 index cc376d7..0000000 --- a/migdal/templates/migdal/entry/submit.html +++ /dev/null @@ -1,26 +0,0 @@ -{% extends "base.html" %} -{% load url from future %} -{% load i18n %} - -{% block "body" %} - -

    {% trans "Submit new story" %}

    - -

    {% blocktrans %} -By submitting a story here, you agree to publish it under the terms of the -Creative Commons Attribution-Share Alike -free license.{% endblocktrans %}

    - -

    {% blocktrans %}Stories are moderated, so please be -patient, you'll be notified when it's published.{% endblocktrans %}

    - -
    -{% csrf_token %} - - {{ submit_form.as_table }} - -
    -
    - - -{% endblock %} \ No newline at end of file diff --git a/migdal/templates/migdal/entry/submit_thanks.html b/migdal/templates/migdal/entry/submit_thanks.html deleted file mode 100755 index 99cecaf..0000000 --- a/migdal/templates/migdal/entry/submit_thanks.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} - -{% block "body" %} - -

    {% trans "Thanks for submitting" %}

    - -

    -{% blocktrans %} -Thank you for submitting this new story, it's waiting for moderation. -If you provided an email, we'll inform you about changes in it's status -and comments. -{% endblocktrans %} -

    - - - -{% endblock %} \ No newline at end of file diff --git a/migdal/templates/migdal/last_comments.html b/migdal/templates/migdal/last_comments.html deleted file mode 100755 index 8deba13..0000000 --- a/migdal/templates/migdal/last_comments.html +++ /dev/null @@ -1,13 +0,0 @@ -{% load gravatar %} -{% load fnp_markup %} - \ No newline at end of file diff --git a/migdal/templates/migdal/mail/manager_new_entry.txt b/migdal/templates/migdal/mail/manager_new_entry.txt deleted file mode 100755 index 59703e2..0000000 --- a/migdal/templates/migdal/mail/manager_new_entry.txt +++ /dev/null @@ -1,14 +0,0 @@ -{% load url from future %}W serwisie pojawił się nowy wpis. -http://localhost:8000{% url 'admin:migdal_entry_change' object.pk %} - -Autor: {{ object.author|default_if_none:"" }} -E-mail: {{ object.author_email|default_if_none:"" }} -Tytuł [pl]: {{ object.title_pl|default_if_none:"" }} -Tytuł [en]: {{ object.title_en|default_if_none:"" }} -Kategorie: {{ object.categories.all|join:", " }} - ---- -{{ object.lead_pl.raw }} ---- -{{ object.lead_en.raw }} ---- \ No newline at end of file diff --git a/migdal/templates/migdal/mail/new_comment.txt b/migdal/templates/migdal/mail/new_comment.txt deleted file mode 100755 index d7074c2..0000000 --- a/migdal/templates/migdal/mail/new_comment.txt +++ /dev/null @@ -1,15 +0,0 @@ -{% load i18n %}{{ comment.content_object.author }}, - -Pod Twoim wpisem pojawił się nowy komentarz. - -{% language 'pl' %}{{ comment.content_object.title }} -http://{{ site.domain }}{{ comment.get_absolute_url }}{% endlanguage %} - - -Autor: {{ comment.name }} - -{{ comment.comment }} - - --- -{{ site }} diff --git a/migdal/templates/migdal/mail/published.txt b/migdal/templates/migdal/mail/published.txt deleted file mode 100755 index b99e1f3..0000000 --- a/migdal/templates/migdal/mail/published.txt +++ /dev/null @@ -1,11 +0,0 @@ -{% load i18n %}{{ entry.author }}, - -Twój wpis został opublikowany: - -{% language 'pl' %}{{ entry.title }} -http://{{ site.domain }}{{ entry.get_absolute_url }}{% endlanguage %} - -Dziękujemy! - --- -{{ site }} diff --git a/migdal/templates/search/search.html b/migdal/templates/search/search.html deleted file mode 100644 index 31be738..0000000 --- a/migdal/templates/search/search.html +++ /dev/null @@ -1,32 +0,0 @@ -{% extends "base.html" %} -{% load url from future %} -{% load i18n %} -{% load migdal_tags %} -{#% load events_tags %#} - - -{% block "body" %} -

    {% trans "Search results" %}

    - -{% for result in page.object_list %} - {% if result.model_name == "entry" %} - {% entry_short result.object %} - {#% elif result.model_name == "event" %#} - {#% event_short result.object %#} - {% endif %} -{% empty %} -

    {% trans "No results found." %}

    -{# Show some example queries to run, maybe query syntax, something else? #} -{% endfor %} - -{% if page.has_previous or page.has_next %} -

    - {% if page.has_previous %} - {% trans "previous" %} - {% endif %} - {% if page.has_next %} - {% trans "next" %} - {% endif %} -{% endif %} - -{% endblock "body" %} diff --git a/migdal/templatetags/__init__.py b/migdal/templatetags/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/migdal/templatetags/migdal_tags.py b/migdal/templatetags/migdal_tags.py deleted file mode 100644 index c1b824c..0000000 --- a/migdal/templatetags/migdal_tags.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django_comments_xtd.models import XtdComment -from django.contrib import comments -from django import template -from migdal import app_settings -from migdal.models import Category, Entry -from django.utils.translation import ugettext_lazy as _ - -register = template.Library() - - -@register.simple_tag(takes_context=True) -def entry_begin(context, entry, detail=False): - t = template.loader.select_template(( - 'migdal/entry/%s/entry_begin.html' % entry.type, - 'migdal/entry/entry_begin.html', - )) - context = { - 'request': context['request'], - 'object': entry, - 'detail': detail, - } - return t.render(template.Context(context)) - - -@register.simple_tag(takes_context=True) -def entry_short(context, entry): - t = template.loader.select_template(( - 'migdal/entry/%s/entry_short.html' % entry.type, - 'migdal/entry/entry_short.html', - )) - context = { - 'request': context['request'], - 'object': entry, - } - return t.render(template.Context(context)) - - -@register.simple_tag(takes_context=True) -def entry_promobox(context, entry, counter): - t = template.loader.select_template(( - 'migdal/entry/%s/entry_promobox.html' % entry.type, - 'migdal/entry/entry_promobox.html', - )) - context = { - 'request': context['request'], - 'object': entry, - 'counter': counter, - } - return t.render(template.Context(context)) - - -@register.inclusion_tag('migdal/categories.html', takes_context=True) -def categories(context, taxonomy): - context = { - 'request': context['request'], - 'object_list': Category.objects.filter(taxonomy=taxonomy - ).exclude(entry__isnull=True) - } - return context - - -@register.inclusion_tag('migdal/last_comments.html') -def last_comments(limit=app_settings.LAST_COMMENTS): - return {'object_list': - XtdComment.objects.filter(is_public=True, is_removed=False).order_by('-submit_date')[:limit]} - - -@register.inclusion_tag(['comments/form.html']) -def entry_comment_form(entry): - return { - 'form': comments.get_form()(entry), - 'next': entry.get_absolute_url(), - } diff --git a/migdal/tests.py b/migdal/tests.py deleted file mode 100644 index 501deb7..0000000 --- a/migdal/tests.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -This file demonstrates writing tests using the unittest module. These will pass -when you run "manage.py test". - -Replace this with more appropriate tests for your application. -""" - -from django.test import TestCase - - -class SimpleTest(TestCase): - def test_basic_addition(self): - """ - Tests that 1 + 1 always equals 2. - """ - self.assertEqual(1 + 1, 2) diff --git a/migdal/urls.py b/migdal/urls.py deleted file mode 100644 index 49a4346..0000000 --- a/migdal/urls.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.conf.urls import patterns, include, url, handler404 -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import string_concat -from migdal import feeds, app_settings -from migdal.views import SearchPublishedView -from fnpdjango.utils.urls import i18n_patterns - -pats = [] -for t in app_settings.TYPES: - pats += [ - # entry list - url(string_concat(r'^', t.slug, r'/$'), - 'migdal.views.entry_list', {'type_db': t.db}, - name='migdal_entry_list_%s' % t.db), - url(string_concat(r'^', t.slug, r'/rss.xml$'), - feeds.EntriesFeed(), {'type_db': t.db}, - name='migdal_entry_list_%s_feed' % t.db), - # single entry - url(string_concat(r'^', t.slug, r'/(?P[^/]+)/$'), - 'migdal.views.entry', {'type_db': t.db}, - name='migdal_entry_%s' % t.db), - ] - - -urlpatterns = i18n_patterns('', - # main page - url(r'^$', 'migdal.views.main', name='migdal_main'), - url(r'^rss.xml$', feeds.EntriesFeed(), name='migdal_main_feed'), - # submit new entry - url(string_concat(r'^', _('submit'), r'/$'), 'migdal.views.submit', name='migdal_submit'), - url(string_concat(r'^', _('submit'), r'/', _('thanks'), r'$'), 'migdal.views.submit_thanks', name='migdal_submit_thanks'), - # category - url(string_concat(r'^', _('categories'), r'/(?P[^/]*)/$'), - 'migdal.views.entry_list', name='migdal_category'), - url(string_concat(r'^', _('categories'), r'/(?P[^/]*)/rss.xml$'), - feeds.EntriesFeed(), name='migdal_category_feed'), - url(string_concat(r'^', _('search')), SearchPublishedView(), name='search'), - # type-specific views - *pats -) diff --git a/migdal/views.py b/migdal/views.py deleted file mode 100644 index 1f769a9..0000000 --- a/migdal/views.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- coding: utf-8 -*- -# This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -from django.http import Http404 -from django.shortcuts import get_object_or_404, render, redirect -from django.utils.translation import get_language -from fnpdjango.utils.views import set_current_object -from migdal import api -from migdal.forms import get_submit_form -from migdal.models import Category, Entry -from migdal import app_settings -from haystack.views import SearchView - - -def main(request): - if app_settings.MAIN_PAGE_ENTRY is not None: - main_entry = Entry.objects.get(**app_settings.MAIN_PAGE_ENTRY) - return entry(request, entry=main_entry) - else: - return entry_list(request) - - -def entry_list(request, type_db=None, category_slug=None): - lang = request.LANGUAGE_CODE - templates = ["migdal/entry/entry_list.html"] - - if type_db: - if app_settings.TYPES_ON_MAIN == (type_db,): - return redirect('migdal_main') - entry_type = app_settings.TYPES_DICT[type_db] - templates = ["migdal/entry/%s/entry_list.html" % type_db] + templates - submit = type_db == app_settings.TYPE_SUBMIT - else: - submit = app_settings.TYPES_ON_MAIN == (app_settings.TYPE_SUBMIT,) - entry_type = None - - if category_slug: - category = get_object_or_404(Category, **{'slug_%s' % lang: category_slug}) - else: - category = None - - if category: - set_current_object(request, category) - - promobox = 5 if entry_type is None and category is None else None - - object_list = api.entry_list(entry_type=entry_type, category=category, - promobox=promobox) - - return render(request, templates, { - 'object_list': object_list, - 'category': category, - 'entry_type': entry_type, - 'submit': submit, - }) - - -def entry(request, type_db=None, slug=None, entry=None): - if entry is None: - lang = request.LANGUAGE_CODE - args = {'type': type_db, 'slug_%s' % lang: slug} - entry = get_object_or_404(Entry, **args) - if not entry.published and not request.user.has_perm('migdal.change_entry'): - raise Http404 - set_current_object(request, entry, in_url=slug is not None) - - templates = ["migdal/entry/entry_detail.html"] - if entry.type is not None: - templates = ["migdal/entry/%s/entry_detail.html" % type_db] + templates - return render(request, templates, {'entry': entry}) - - -def submit(request): - if request.method == 'POST': - submit_form = get_submit_form(request.POST) - if submit_form.is_valid(): - submit_form.save() - return redirect('migdal_submit_thanks') - else: - submit_form = get_submit_form() - - return render(request, 'migdal/entry/submit.html', { - 'submit_form': submit_form, - }) - -def submit_thanks(request): - return render(request, "migdal/entry/submit_thanks.html") - - -class SearchPublishedView(SearchView): - def __init__(self, *args, **kwargs): - super(SearchPublishedView, self).__init__(*args, **kwargs) - - def get_results(self): - results = super(SearchPublishedView, self).get_results() - lang_code = get_language() - def is_published(entity): - if isinstance(entity, Entry): - return getattr(entity, "published_%s" % lang_code) == True - else: - return True - results = filter(lambda r: is_published(r.object), results) - print results - return results diff --git a/requirements.txt b/requirements.txt index 0aaad30..72f4b93 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,9 +6,14 @@ PIL sorl-thumbnail>=11.09,<12 django-pagination +-e git+git://github.com/fnp/fnpdjango.git@7b2a81536977bb13b68ada3e5a281e35b24e0bfd#egg=fnpdjango +-e git+git://github.com/fnp/django-migdal.git@734cd58d3f12c5397b42c1ae122c947500386014#egg=django-migdal + #django-jsonfield -e git+git://github.com/bradjasper/django-jsonfield.git@2f427368ad70bf8d9a0580df58ec0eb0654d62ae#egg=django-jsonfield +-e git+git://github.com/fnp/django-migdal.git@734cd58d3f12c5397b42c1ae122c947500386014#egg=django-migdal + textile django-markupfield django-gravatar diff --git a/slughifi.py b/slughifi.py deleted file mode 100644 index fe5c9e3..0000000 --- a/slughifi.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -import re -from types import UnicodeType - -from django.template.defaultfilters import slugify - -# default unicode character mapping ( you may not see some chars, leave as is ) -char_map = {u'À': 'A', u'Á': 'A', u'Â': 'A', u'Ã': 'A', u'Ä': 'Ae', u'Å': 'A', u'Æ': 'A', u'Ā': 'A', u'Ą': 'A', u'Ă': 'A', u'Ç': 'C', u'Ć': 'C', u'Č': 'C', u'Ĉ': 'C', u'Ċ': 'C', u'Ď': 'D', u'Đ': 'D', u'È': 'E', u'É': 'E', u'Ê': 'E', u'Ë': 'E', u'Ē': 'E', u'Ę': 'E', u'Ě': 'E', u'Ĕ': 'E', u'Ė': 'E', u'Ĝ': 'G', u'Ğ': 'G', u'Ġ': 'G', u'Ģ': 'G', u'Ĥ': 'H', u'Ħ': 'H', u'Ì': 'I', u'Í': 'I', u'Î': 'I', u'Ï': 'I', u'Ī': 'I', u'Ĩ': 'I', u'Ĭ': 'I', u'Į': 'I', u'İ': 'I', u'IJ': 'IJ', u'Ĵ': 'J', u'Ķ': 'K', u'Ľ': 'K', u'Ĺ': 'K', u'Ļ': 'K', u'Ŀ': 'K', u'Ł': 'L', u'Ñ': 'N', u'Ń': 'N', u'Ň': 'N', u'Ņ': 'N', u'Ŋ': 'N', u'Ò': 'O', u'Ó': 'O', u'Ô': 'O', u'Õ': 'O', u'Ö': 'Oe', u'Ø': 'O', u'Ō': 'O', u'Ő': 'O', u'Ŏ': 'O', u'Œ': 'OE', u'Ŕ': 'R', u'Ř': 'R', u'Ŗ': 'R', u'Ś': 'S', u'Ş': 'S', u'Ŝ': 'S', u'Ș': 'S', u'Š': 'S', u'Ť': 'T', u'Ţ': 'T', u'Ŧ': 'T', u'Ț': 'T', u'Ù': 'U', u'Ú': 'U', u'Û': 'U', u'Ü': 'Ue', u'Ū': 'U', u'Ů': 'U', u'Ű': 'U', u'Ŭ': 'U', u'Ũ': 'U', u'Ų': 'U', u'Ŵ': 'W', u'Ŷ': 'Y', u'Ÿ': 'Y', u'Ý': 'Y', u'Ź': 'Z', u'Ż': 'Z', u'Ž': 'Z', u'à': 'a', u'á': 'a', u'â': 'a', u'ã': 'a', u'ä': 'ae', u'ā': 'a', u'ą': 'a', u'ă': 'a', u'å': 'a', u'æ': 'ae', u'ç': 'c', u'ć': 'c', u'č': 'c', u'ĉ': 'c', u'ċ': 'c', u'ď': 'd', u'đ': 'd', u'è': 'e', u'é': 'e', u'ê': 'e', u'ë': 'e', u'ē': 'e', u'ę': 'e', u'ě': 'e', u'ĕ': 'e', u'ė': 'e', u'ƒ': 'f', u'ĝ': 'g', u'ğ': 'g', u'ġ': 'g', u'ģ': 'g', u'ĥ': 'h', u'ħ': 'h', u'ì': 'i', u'í': 'i', u'î': 'i', u'ï': 'i', u'ī': 'i', u'ĩ': 'i', u'ĭ': 'i', u'į': 'i', u'ı': 'i', u'ij': 'ij', u'ĵ': 'j', u'ķ': 'k', u'ĸ': 'k', u'ł': 'l', u'ľ': 'l', u'ĺ': 'l', u'ļ': 'l', u'ŀ': 'l', u'ñ': 'n', u'ń': 'n', u'ň': 'n', u'ņ': 'n', u'ʼn': 'n', u'ŋ': 'n', u'ò': 'o', u'ó': 'o', u'ô': 'o', u'õ': 'o', u'ö': 'oe', u'ø': 'o', u'ō': 'o', u'ő': 'o', u'ŏ': 'o', u'œ': 'oe', u'ŕ': 'r', u'ř': 'r', u'ŗ': 'r', u'ś': 's', u'š': 's', u'ť': 't', u'ù': 'u', u'ú': 'u', u'û': 'u', u'ü': 'ue', u'ū': 'u', u'ů': 'u', u'ű': 'u', u'ŭ': 'u', u'ũ': 'u', u'ų': 'u', u'ŵ': 'w', u'ÿ': 'y', u'ý': 'y', u'ŷ': 'y', u'ż': 'z', u'ź': 'z', u'ž': 'z', u'ß': 'ss', u'ſ': 'ss', u'Α': 'A', u'Ά': 'A', u'Ἀ': 'A', u'Ἁ': 'A', u'Ἂ': 'A', u'Ἃ': 'A', u'Ἄ': 'A', u'Ἅ': 'A', u'Ἆ': 'A', u'Ἇ': 'A', u'ᾈ': 'A', u'ᾉ': 'A', u'ᾊ': 'A', u'ᾋ': 'A', u'ᾌ': 'A', u'ᾍ': 'A', u'ᾎ': 'A', u'ᾏ': 'A', u'Ᾰ': 'A', u'Ᾱ': 'A', u'Ὰ': 'A', u'Ά': 'A', u'ᾼ': 'A', u'Β': 'B', u'Γ': 'G', u'Δ': 'D', u'Ε': 'E', u'Έ': 'E', u'Ἐ': 'E', u'Ἑ': 'E', u'Ἒ': 'E', u'Ἓ': 'E', u'Ἔ': 'E', u'Ἕ': 'E', u'Έ': 'E', u'Ὲ': 'E', u'Ζ': 'Z', u'Η': 'I', u'Ή': 'I', u'Ἠ': 'I', u'Ἡ': 'I', u'Ἢ': 'I', u'Ἣ': 'I', u'Ἤ': 'I', u'Ἥ': 'I', u'Ἦ': 'I', u'Ἧ': 'I', u'ᾘ': 'I', u'ᾙ': 'I', u'ᾚ': 'I', u'ᾛ': 'I', u'ᾜ': 'I', u'ᾝ': 'I', u'ᾞ': 'I', u'ᾟ': 'I', u'Ὴ': 'I', u'Ή': 'I', u'ῌ': 'I', u'Θ': 'TH', u'Ι': 'I', u'Ί': 'I', u'Ϊ': 'I', u'Ἰ': 'I', u'Ἱ': 'I', u'Ἲ': 'I', u'Ἳ': 'I', u'Ἴ': 'I', u'Ἵ': 'I', u'Ἶ': 'I', u'Ἷ': 'I', u'Ῐ': 'I', u'Ῑ': 'I', u'Ὶ': 'I', u'Ί': 'I', u'Κ': 'K', u'Λ': 'L', u'Μ': 'M', u'Ν': 'N', u'Ξ': 'KS', u'Ο': 'O', u'Ό': 'O', u'Ὀ': 'O', u'Ὁ': 'O', u'Ὂ': 'O', u'Ὃ': 'O', u'Ὄ': 'O', u'Ὅ': 'O', u'Ὸ': 'O', u'Ό': 'O', u'Π': 'P', u'Ρ': 'R', u'Ῥ': 'R', u'Σ': 'S', u'Τ': 'T', u'Υ': 'Y', u'Ύ': 'Y', u'Ϋ': 'Y', u'Ὑ': 'Y', u'Ὓ': 'Y', u'Ὕ': 'Y', u'Ὗ': 'Y', u'Ῠ': 'Y', u'Ῡ': 'Y', u'Ὺ': 'Y', u'Ύ': 'Y', u'Φ': 'F', u'Χ': 'X', u'Ψ': 'PS', u'Ω': 'O', u'Ώ': 'O', u'Ὠ': 'O', u'Ὡ': 'O', u'Ὢ': 'O', u'Ὣ': 'O', u'Ὤ': 'O', u'Ὥ': 'O', u'Ὦ': 'O', u'Ὧ': 'O', u'ᾨ': 'O', u'ᾩ': 'O', u'ᾪ': 'O', u'ᾫ': 'O', u'ᾬ': 'O', u'ᾭ': 'O', u'ᾮ': 'O', u'ᾯ': 'O', u'Ὼ': 'O', u'Ώ': 'O', u'ῼ': 'O', u'α': 'a', u'ά': 'a', u'ἀ': 'a', u'ἁ': 'a', u'ἂ': 'a', u'ἃ': 'a', u'ἄ': 'a', u'ἅ': 'a', u'ἆ': 'a', u'ἇ': 'a', u'ᾀ': 'a', u'ᾁ': 'a', u'ᾂ': 'a', u'ᾃ': 'a', u'ᾄ': 'a', u'ᾅ': 'a', u'ᾆ': 'a', u'ᾇ': 'a', u'ὰ': 'a', u'ά': 'a', u'ᾰ': 'a', u'ᾱ': 'a', u'ᾲ': 'a', u'ᾳ': 'a', u'ᾴ': 'a', u'ᾶ': 'a', u'ᾷ': 'a', u'β': 'b', u'γ': 'g', u'δ': 'd', u'ε': 'e', u'έ': 'e', u'ἐ': 'e', u'ἑ': 'e', u'ἒ': 'e', u'ἓ': 'e', u'ἔ': 'e', u'ἕ': 'e', u'ὲ': 'e', u'έ': 'e', u'ζ': 'z', u'η': 'i', u'ή': 'i', u'ἠ': 'i', u'ἡ': 'i', u'ἢ': 'i', u'ἣ': 'i', u'ἤ': 'i', u'ἥ': 'i', u'ἦ': 'i', u'ἧ': 'i', u'ᾐ': 'i', u'ᾑ': 'i', u'ᾒ': 'i', u'ᾓ': 'i', u'ᾔ': 'i', u'ᾕ': 'i', u'ᾖ': 'i', u'ᾗ': 'i', u'ὴ': 'i', u'ή': 'i', u'ῂ': 'i', u'ῃ': 'i', u'ῄ': 'i', u'ῆ': 'i', u'ῇ': 'i', u'θ': 'th', u'ι': 'i', u'ί': 'i', u'ϊ': 'i', u'ΐ': 'i', u'ἰ': 'i', u'ἱ': 'i', u'ἲ': 'i', u'ἳ': 'i', u'ἴ': 'i', u'ἵ': 'i', u'ἶ': 'i', u'ἷ': 'i', u'ὶ': 'i', u'ί': 'i', u'ῐ': 'i', u'ῑ': 'i', u'ῒ': 'i', u'ΐ': 'i', u'ῖ': 'i', u'ῗ': 'i', u'κ': 'k', u'λ': 'l', u'μ': 'm', u'ν': 'n', u'ξ': 'ks', u'ο': 'o', u'ό': 'o', u'ὀ': 'o', u'ὁ': 'o', u'ὂ': 'o', u'ὃ': 'o', u'ὄ': 'o', u'ὅ': 'o', u'ὸ': 'o', u'ό': 'o', u'π': 'p', u'ρ': 'r', u'ῤ': 'r', u'ῥ': 'r', u'σ': 's', u'ς': 's', u'τ': 't', u'υ': 'y', u'ύ': 'y', u'ϋ': 'y', u'ΰ': 'y', u'ὐ': 'y', u'ὑ': 'y', u'ὒ': 'y', u'ὓ': 'y', u'ὔ': 'y', u'ὕ': 'y', u'ὖ': 'y', u'ὗ': 'y', u'ὺ': 'y', u'ύ': 'y', u'ῠ': 'y', u'ῡ': 'y', u'ῢ': 'y', u'ΰ': 'y', u'ῦ': 'y', u'ῧ': 'y', u'φ': 'f', u'χ': 'x', u'ψ': 'ps', u'ω': 'o', u'ώ': 'o', u'ὠ': 'o', u'ὡ': 'o', u'ὢ': 'o', u'ὣ': 'o', u'ὤ': 'o', u'ὥ': 'o', u'ὦ': 'o', u'ὧ': 'o', u'ᾠ': 'o', u'ᾡ': 'o', u'ᾢ': 'o', u'ᾣ': 'o', u'ᾤ': 'o', u'ᾥ': 'o', u'ᾦ': 'o', u'ᾧ': 'o', u'ὼ': 'o', u'ώ': 'o', u'ῲ': 'o', u'ῳ': 'o', u'ῴ': 'o', u'ῶ': 'o', u'ῷ': 'o', u'¨': '', u'΅': '', u'᾿': '', u'῾': '', u'῍': '', u'῝': '', u'῎': '', u'῞': '', u'῏': '', u'῟': '', u'῀': '', u'῁': '', u'΄': '', u'΅': '', u'`': '', u'῭': '', u'ͺ': '', u'᾽': '', u'А': 'A', u'Б': 'B', u'В': 'V', u'Г': 'G', u'Д': 'D', u'Е': 'E', u'Ё': 'E', u'Ж': 'ZH', u'З': 'Z', u'И': 'I', u'Й': 'I', u'К': 'K', u'Л': 'L', u'М': 'M', u'Н': 'N', u'О': 'O', u'П': 'P', u'Р': 'R', u'С': 'S', u'Т': 'T', u'У': 'U', u'Ф': 'F', u'Х': 'KH', u'Ц': 'TS', u'Ч': 'CH', u'Ш': 'SH', u'Щ': 'SHCH', u'Ы': 'Y', u'Э': 'E', u'Ю': 'YU', u'Я': 'YA', u'а': 'A', u'б': 'B', u'в': 'V', u'г': 'G', u'д': 'D', u'е': 'E', u'ё': 'E', u'ж': 'ZH', u'з': 'Z', u'и': 'I', u'й': 'I', u'к': 'K', u'л': 'L', u'м': 'M', u'н': 'N', u'о': 'O', u'п': 'P', u'р': 'R', u'с': 'S', u'т': 'T', u'у': 'U', u'ф': 'F', u'х': 'KH', u'ц': 'TS', u'ч': 'CH', u'ш': 'SH', u'щ': 'SHCH', u'ы': 'Y', u'э': 'E', u'ю': 'YU', u'я': 'YA', u'Ъ': '', u'ъ': '', u'Ь': '', u'ь': '', u'ð': 'd', u'Ð': 'D', u'þ': 'th', u'Þ': 'TH', - u'ა': 'a', u'ბ': 'b', u'გ': 'g', u'დ': 'd', u'ე': 'e', u'ვ': 'v', u'ზ': 'z', u'თ': 't', u'ი': 'i', u'კ': 'k', u'ლ': 'l', u'მ': 'm', u'ნ': 'n', u'ო': 'o', u'პ': 'p', u'ჟ': 'zh', u'რ': 'r', u'ს': 's', u'ტ': 't', u'უ': 'u', u'ფ': 'p', u'ქ': 'k', u'ღ': 'gh', u'ყ': 'q', u'შ': 'sh', u'ჩ': 'ch', u'ც': 'ts', u'ძ': 'dz', u'წ': 'ts', u'ჭ': 'ch', u'ხ': 'kh', u'ჯ': 'j', u'ჰ': 'h' } - -def replace_char(m): - char = m.group() - if char_map.has_key(char): - return char_map[char] - else: - return char - -def slughifi(value, do_slugify=True, overwrite_char_map={}): - """ - High Fidelity slugify - slughifi.py, v 0.1 - - Examples : - - >>> text = 'C\'est déjà l\'été.' - - >>> slughifi(text) - 'cest-deja-lete' - - >>> slughifi(text, overwrite_char_map={u'\'': '-',}) - 'c-est-deja-l-ete' - - >>> slughifi(text, do_slugify=False) - "C'est deja l'ete." - - # Normal slugify removes accented characters - >>> slugify(text) - 'cest-dj-lt' - - """ - - # unicodification - if type(value) != UnicodeType: - value = unicode(value, 'utf-8', 'ignore') - - # overwrite chararcter mapping - char_map.update(overwrite_char_map) - - # try to replace chars - value = re.sub('[^a-zA-Z0-9\\s\\-]{1}', replace_char, value) - - # apply django default slugify - if do_slugify: - value = slugify(value) - - return value.encode('ascii', 'ignore') -