-from prawokultury.helpers import AppSettings
+from fnpdjango.utils.app import AppSettings
class Settings(AppSettings):
#
from django.conf import settings
from django.contrib import admin
+from fnpdjango.utils.models.translation import translated_fields
from events.models import Event
-from migdal.helpers import translated_fields
class EventAdmin(admin.ModelAdmin):
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
-from migdal.helpers import add_translatable
+from fnpdjango.utils.models.translation import add_translatable
class Event(models.Model):
-from django.conf import settings
import datetime
+from django.conf import settings
from haystack import indexes
+from fnpdjango.utils.models.translation import add_translatable_index
from events.models import Event
-from migdal.helpers import add_translatable_index
class EventIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
{% extends "base.html" %}
{% load url from future %}
-{% load i18n pagination_tags prevnext %}
+{% load i18n pagination_tags fnp_prevnext %}
{% load events_tags %}
{% block "body" %}
--- /dev/null
+from fnpdjango.utils.app import AppSettings
+
+
+class Settings(AppSettings):
+ MODULE = 'menu_items'
+
+
+app_settings = Settings('MENU')
--- /dev/null
+class MenuItem(object):
+ html_id = None
+
+ def __init__(self, url, title, html_id=None, more_urls=None):
+ self.url = url
+ self.title = title
+ self.html_id = html_id
+ self.more_urls = more_urls or set()
+
+ def is_active(self, request, value):
+ url = request.get_full_path()
+ return url == str(self.url) or url in set(str(url) for url in self.more_urls)
+
+ def check_active(self, request, value):
+ self.active = self.is_active(request, value)
+
+ def get_url(self):
+ return self.url
+
+ def get_title(self):
+ return self.title
+
+
+class ObjectMenuItem(MenuItem):
+ """Menu item corresponding to an object.
+
+ If no url or title is provided, get_absolute_url and __unicode__ are used.
+ You can also provide a reverse lookup dictionary, as in {model: field_name}.
+ """
+ def __init__(self, obj, url=None, rev_lookups=None, title=None, html_id=None):
+ super(ObjectMenuItem, self).__init__(url=url, title=title, html_id=html_id)
+ self.obj = obj
+ self.rev_lookups = rev_lookups
+
+ def get_title(self):
+ return self.title or unicode(self.obj)
+
+ @property
+ def get_url(self):
+ return self.url or self.obj.get_absolute_url()
+
+ def is_active(self, request, value):
+ if value == self.obj:
+ return True
+ if self.rev_lookups:
+ for model, manager in self.rev_lookups.items():
+ if (isinstance(value, model) and
+ self.obj in getattr(value, manager).all()):
+ return True
+ return False
+
+
+class ModelMenuItem(MenuItem):
+ """Menu item corresponding to a model, optionally filtered by some fields."""
+
+ def __init__(self, model, url, field_lookups=None, title=None, html_id=None):
+ if title is None:
+ title = unicode(model)
+ super(ModelMenuItem, self).__init__(title=title, url=url, html_id=html_id)
+ self.model = model
+ self.field_lookups = field_lookups
+
+ def is_active(self, request, value):
+ if value == self.model and not self.field_lookups:
+ return True
+ if str(self.url) == request.get_full_path():
+ return True
+ if isinstance(value, self.model) and self.field_lookups:
+ lookups_ok = True
+ for field, lookup in self.field_lookups.items():
+ if getattr(value, field) != lookup:
+ lookups_ok = False
+ if lookups_ok:
+ return True
+ return False
+
+ def get_title(self):
+ return self.title or unicode(self.model)
--- /dev/null
+import importlib
+from . import app_settings
+
+items = importlib.import_module(app_settings.MODULE).ITEMS
--- /dev/null
+{% load i18n %}
+{% for item in items %}
+ <li{% if item.active %}
+ class="active"{%endif %} {% if item.html_id %}
+ id="{{ item.html_id}}"{% endif %}>
+ <a href="{{ item.get_url }}">{{ item.get_title }}</a></li>
+{% endfor %}
--- /dev/null
+from django import template
+from fnpdjango.utils.views import get_current_object
+from ..models import items
+
+register = template.Library()
+
+
+@register.inclusion_tag('menu/menu.html', takes_context=True)
+def main_menu(context):
+ request = context['request']
+ obj = get_current_object(request)
+ for item in items:
+ item.check_active(request, obj)
+ return {'items': items}
+++ /dev/null
-# -*- coding: utf-8 -*-
-"""
-Migdal (מִגְדָּל) is a multilingual blog Django app.
-
-Author: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
-"""
-from django.conf import settings
-from prawokultury.helpers 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),
- EntryType('publications', _('publications'), commentable=False, on_main=False),
- EntryType('info', _('info'), commentable=False, on_main=False),
- )
- TYPE_SUBMIT = 'news'
- TAXONOMIES = (
- ('topics', _('topics')),
- ('types', _('types')),
- )
- LAST_COMMENTS = 5
-
- 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)
-
- 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')
-
-
-
+++ /dev/null
-# -*- 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 Category, Entry, Attachment
-from migdal import app_settings
-from migdal.helpers import translated_fields
-
-
-class AttachmentInline(admin.TabularInline):
- model = Attachment
- readonly_fields = ['url']
-
-
-class EntryAdmin(admin.ModelAdmin):
- date_hierarchy = 'date'
- readonly_fields = ('date', 'changed_at') + translated_fields(('published_at',))
- fieldsets = (
- (None, {'fields': (('type', 'promo'), '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
- ) + (
- (_('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
- ) + ('type', 'date', 'author', 'promo'
- ) + translated_fields(('published',)
- ) + translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES)
- list_filter = ('type', 'promo') + translated_fields(('published',)
- ) + translated_fields(('needed',), app_settings.OPTIONAL_LANGUAGES)
- inlines = (AttachmentInline,)
-
-
-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(Entry, EntryAdmin)
-admin.site.register(Category, CategoryAdmin)
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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("<img src='%s'/>" % image, item.lead)
-
- def item_pubdate(self, item):
- return item.published_at
+++ /dev/null
-# -*- 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"])
+++ /dev/null
-# -*- 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 slughifi 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
+++ /dev/null
-# -*- 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 collections import namedtuple
-from copy import copy
-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 EntryType(namedtuple('EntryType', 'db slug commentable on_main')):
- __slots__ = ()
- def __unicode__(self):
- return unicode(self.slug)
-
-
-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?
-
-
-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)]
-
-
-def add_translatable_index(index_class, fields, languages=None):
- """Adds some translatable fields to a search index, 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)
- 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):
- return tuple("%s_%s" % (field_name, lang_code)
- for field_name in field_names
- for lang_code, lang_name in languages
- )
+++ /dev/null
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-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 <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
-"Language-Team: FNP <fundacja@nowoczesnapolska.org.pl>\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 <a href=\"http://textile.thresholdstate.com/\">Textile</a> syntax."
-msgstr "Włączona składnia <a href=\"http://textile.thresholdstate.com/\">Textile</a>."
-
-#: 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"
-"<a href='http://creativecommons.org/licenses/by-sa/3.0/'>Creative Commons Attribution-Share Alike</a>\n"
-"free license."
-msgstr ""
-"\n"
-"Dodając wpis, zgadzasz się najego publikację na warunkach wolnej licencji\n"
-"<a href='http://creativecommons.org/licenses/by-sa/3.0/deed.pl'>Creative Commons Uznanie autorstwa – Na tych samych warunkach</a>."
-
-#: 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."
+++ /dev/null
-# -*- 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.utils import translation
-from django.conf import settings
-from django.http import Http404
-
-
-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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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
+++ /dev/null
-# -*- 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 migdal.helpers 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):
- 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
- super(Entry, self).save(*args, **kwargs)
- if published_now:
- self.notify_author_published()
-
- 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 <a href="http://textile.thresholdstate.com/">Textile</a> syntax.')),
- 'body': MarkupField(_('body'), markup_type='textile_pl', null=True, blank=True,
- help_text=_('Use <a href="http://textile.thresholdstate.com/">Textile</a> 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
+++ /dev/null
-from django.conf import settings
-import datetime
-from haystack import indexes
-from migdal.models import Entry
-from migdal.helpers import add_translatable_index
-
-
-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
+++ /dev/null
-{% load comments i18n %}
-<div class="comment-form">
-<h2 class="section">{% trans "Add comment" %}</h2>
-<form class="submit-form" action="{% comment_form_target %}" method="post">{% csrf_token %}
- {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %}
- {% for field in form %}
- {% if field.is_hidden %}
- {{ field }}
- {% endif %}
- {% endfor %}
- <table>
- {% for field in form %}
- {% if not field.is_hidden %}
- <tr
- {% ifequal field.name "honeypot" %} style="display:none;"{% endifequal %}>
- <th>{{ field.label_tag }}
- </th><td>
- {% if field.errors %}<p class="error">{{ field.errors }}</p>{% endif %}
- {{ field }}
- </td></tr>
- {% endif %}
- {% endfor %}
- <tr><td></td><td>
- <button type="submit" name="post" class="submit-post">{% trans "Post" %}</button>
- <button type="submit" name="preview" class="submit-preview">{% trans "Preview" %}</button>
- </td></tr>
- </table>
-</form>
-</div>
+++ /dev/null
-{% load i18n %}
-{% load gravatar %}
-{% load markup_tags %}
-<a name="comment"></a>
-<h2 class="section">{% trans "Comments" %}</h2>
-<div class="comments">
- {% for comment in comment_list %}
- <div class="comment" id="c{{ comment.id }}">
- <img class="avatar" src="{% gravatar_for_email comment.email 64 %}" alt="Avatar"/>
- <div class="comment-data">
- <div class="comment-author">
- {% if comment.url %}
- <a rel="nofollow" href="{{ comment.url }}">
- {% endif %}
- {{ comment.name }}
- {% if comment.url %}
- </a>
- {% endif %}
- </div>
- <div class="comment-date">{{ comment.submit_date }}</div>
- </div>
- <div class="body">{{ comment.comment|textile_restricted_pl }}</div>
- </div>
- {% endfor %}
- <div style="clear: both"></div>
-</div>
\ No newline at end of file
+++ /dev/null
-{% extends "base.html" %}
-{% load comments gravatar i18n %}
-{% load migdal_tags markup_tags %}
-
-
-{% block "main_menu" %}
- {% main_menu 'object' entry %}
-{% endblock "main_menu" %}
-
-
-{% block "body" %}
-
-<div class="entry entry-detail entry-{{ entry.type }}">
-<div class="entry-wrapped">
-
-{% entry_begin form.target_object 1 %}
-<div class="body">
-{{ form.target_object.body }}
-</div>
-
-{% if form.target_object.get_type.commentable %}
- <div style="clear: both"></div>
-
- {% render_comment_list for form.target_object %}
-
- <h2 class="section">{% trans "Preview your comment" %}</h2>
- <div class="comments">
-
- <div class="comment preview">
- <img class="avatar" src="{% gravatar_for_email form.email.value 64 %}" alt="Avatar"/>
- <div class="comment-data">
- <div class="comment-author">{{ form.name.value }}</div>
- </div>
- <div class="body">{{ comment|textile_restricted_pl }}</div>
- <div style="clear: both"></div>
- </div>
-
- {% include "comments/form.html" %}
-
- </div>
-{% endif %}
-</div>
-</div>
-
-{% endblock %}
+++ /dev/null
-{% load i18n %}
-<p>{{ user_name }},</p>
-
-<p>Pojawił się nowy komentarz w wątku z Twoim udziałem.</p>
-
-<p>
-{% language 'pl' %}
- <a href="http://{{ site.domain }}{{ content_object.get_absolute_url }}">„{{ content_object.title }}”</a>
-{% endlanguage %}
-</p>
-
-<p>{{ comment.name }}, {{ comment.submit_date|date:"SHORT_DATE_FORMAT" }}:</p>
-<blockquote>
-{{ comment.comment }}
-</blockquote>
-
-<p>--<br/>
-{{ site }}
-</p>
+++ /dev/null
-{% 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 }}
+++ /dev/null
-<ul class="categories">
- {% for cat in object_list %}
- <li class="category category-taxonomy-{{ cat.taxonomy }}">
- <a href="{{ cat.get_absolute_url }}">{{ cat }}</a>
- </li>
- {% endfor %}
-</ul>
\ No newline at end of file
+++ /dev/null
-{% load i18n %}
-{% load gravatar thumbnail %}
-
-<img class="avatar" src="{% gravatar_for_email object.author_email 64 %}" alt="Avatar"/>
-{% if detail %}
- <h1>{{ object.title }}</h1>
-{% else %}
- <h2><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2>
-{% endif %}
-
-<div class="entry-data">
-<div class="date">{{ object.published_at }}</div>
-<div class="author">{{ object.author }}</div>
-
-{% comment %}
-{% if request.LANGUAGE_CODE == 'pl' %}
- {% if object.published_en %}
- {% language 'en' %}
- <a href="{{ object.get_absolute_url }}">English version</a>
- {% endlanguage %}
- {% endif %}
-{% elif object.published_pl %}
- {% language 'pl' %}
- <a href="{{ object.get_absolute_url }}">polska wersja</a>
- {% endlanguage %}
-{% endif %}
-{% endcomment %}
-
-<div class="categories">
-{% for category in object.categories.all %}
- {% if forloop.counter != 1 %}/{% endif %}
- <a href="{{ category.get_absolute_url }}">{{ category }}</a>
-{% endfor %}
-</div>
-
-</div>
-
-{% if object.image %}
- <img class="entry-picture" src="{% thumbnail object.image "200x150" as thumb %}
- {{ thumb.url }}
- {% empty %}
- {{ object.image.url }}
- {% endthumbnail %}" />
-{% endif %}
-<div class="lead">
-{{ object.lead }}
-</div>
+++ /dev/null
-{% extends "base.html" %}
-{% load comments i18n %}
-{% load common_tags migdal_tags 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 "main_menu" %}
- {% main_menu 'object' entry %}
-{% endblock "main_menu" %}
-
-
-{% block "body" %}
-
-{% if not entry.published %}
- <p class="warning">{% trans "This entry hasn't been published yet." %}</p>
-{% endif %}
-
-<div class="entry entry-detail entry-{{ entry.type }}">
-<div class="entry-wrapped">
-
-{% entry_begin entry 1 %}
-<div class="body">
-{{ entry.body }}
-</div>
-
-<div style="clear: both;"></div>
-
-<div class="toolbar">
-<div class="social">
- {% share object.get_absolute_url object.title %}
-</div>
-</div>
-
-<div style="clear: both"></div>
-
-{% if entry.get_type.commentable %}
- {% render_comment_list for entry %}
- <div class="comments">
- {% entry_comment_form entry %}
- </div>
-{% endif %}
-</div>
-</div>
-
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% extends "base.html" %}
-{% load url from future %}
-{% load i18n %}
-{% load pagination_tags prevnext %}
-{% load migdal_tags %}
-
-
-{% block "main_menu" %}
- {% if category %}
- {% main_menu 'object' category %}
- {% elif entry_type %}
- {% main_menu 'entry_type' entry_type.db %}
- {% else %}
- {{ block.super }}
- {% endif %}
-{% endblock "main_menu" %}
-
-
-{% block "body" %}
-
-{% if category %}
- <h1>{% trans "Category" %}: {{ category }}
- <!--a href="{% url 'migdal_category_feed' category.slug %}">RSS</a-->
- </h1>
-{% elif entry_type %}
- <h1>{{ entry_type|capfirst }}
- <!--a href="{% url 'migdal_entry_list_'|add:entry_type.db|add:'_feed' %}">RSS</a-->
- </h1>
-{% endif %}
-
-{% if object_list.promobox and request.page == 1 %}
-<div id="promobox">
-<ul id="promobox-switcher">
-{% for object in object_list.promobox %}
- <li {% if forloop.counter == 1 %} class="active"{% endif %}>
- <a href="{{ object.get_absolute_url }}"
- >{{ forloop.counter }}</a>
- </li>
-{% endfor %}
-</ul>
-
-<div id="promobox-wrapper">
-<ul class="promobox">
-{% for object in object_list.promobox %}
- {% entry_promobox object forloop.counter %}
-{% endfor %}
-</ul>
-</div>
-
-</div>
-{% endif %}
-
-{% if submit %}
- <p class="submit-link">
- <a href="{% url 'migdal_submit' %}">{% trans "Submit a new story, create Culture's Right with us!" %}</a>
- </p>
-{% endif %}
-
-
-{% autopaginate object_list 10 %}
-{% for object in object_list %}
- {% entry_short object %}
-{% endfor %}
-{% prevnext %}
-
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% load i18n thumbnail %}
-
-
-<li class="promobox-item{% if counter == 1 %} active{% endif %}"
- style="
- {% if counter != 1 %}display: none;{% endif %}
- {% if object.image %}
- background: url('{% thumbnail object.image "700x1000" as thumb %}{{ thumb.url }}{% empty %}{{ object.image.url }}{% endthumbnail %}');
- background-size:100%;
- background-position: 50% 50%;
- {% else %}
- background: black;
- {% endif %}
-">
-
-<a class="promobox-link" href="{{ object.get_absolute_url }}">
-
-
-<div class="promobox-info">
-<div class="clip">
-<h2>{{ object.title }}</h2>
-
-<div class="lead">
-{{ object.lead|striptags|truncatewords:8 }}
-</div>
-</div>
-</div>
-
-</a>
-</li>
+++ /dev/null
-{% load i18n %}
-{% load comments %}
-{% load migdal_tags share %}
-
-
-<div class="entry entry-short entry-{{ object.type }}">
-<div class="entry-wrapped">
-
-{% entry_begin object %}
-
-<div style="clear: both;"></div>
-
-<div class="toolbar">
-<div class="more">
-
-{% if object.get_type.commentable %}
-{% get_comment_count for object as comment_count %}
-<a class="comments" href="{{ object.get_absolute_url }}#comment">
-{% blocktrans count comment_count as c %}{{c}} comment{% plural %}{{c}} comments{% endblocktrans %}
-</a>
-{% endif %}
-
-{% if object.body.raw %}
- <a class="read-more" href="{{ object.get_absolute_url }}">{% trans "read more" %}</a>
-{% endif %}
-
-</div>
-
-<div class="social">
- {% share object.get_absolute_url object.title %}
-</div>
-</div>
-
-
-
-<div style="clear: both"></div>
-</div>
-</div>
+++ /dev/null
-{% load i18n %}
-{% load thumbnail %}
-
-{% if detail %}
- <h1>{{ object.title }}</h1>
-{% else %}
- <h2><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2>
-{% endif %}
-
-
-{% comment %}
-<div class="entry-data">
-{% if request.LANGUAGE_CODE == 'pl' %}
- {% if object.published_en %}
- {% language 'en' %}
- <a href="{{ object.get_absolute_url }}">English version</a>
- {% endlanguage %}
- {% endif %}
-{% elif object.published_pl %}
- {{ request.LANGUAGE_CODE }}
- {% language 'pl' %}
- <a href="{{ object.get_absolute_url }}">polska wersja</a>
- {% endlanguage %}
-{% endif %}
-</div>
-{% endcomment %}
-
-
-{% if object.image %}
- <img class="entry-picture" src="{% thumbnail object.image "250x300" as thumb %}
- {{ thumb.url }}
- {% empty %}
- {{ object.image.url }}
- {% endthumbnail %}" />
-{% endif %}
-<div class="lead">
-{{ object.lead }}
-</div>
+++ /dev/null
-{% load i18n %}
-{% load thumbnail %}
-
-{% if detail %}
- <h1>{{ object.title }}</h1>
-{% else %}
- <h2><a href="{{ object.get_absolute_url }}">{{ object.title }}</a></h2>
-{% endif %}
-
-
-{% comment %}
-<div class="entry-data">
-{% if request.LANGUAGE_CODE == 'pl' %}
- {% if object.published_en %}
- {% language 'en' %}
- <a href="{{ object.get_absolute_url }}">English version</a>
- {% endlanguage %}
- {% endif %}
-{% elif object.published_pl %}
- {{ request.LANGUAGE_CODE }}
- {% language 'pl' %}
- <a href="{{ object.get_absolute_url }}">polska wersja</a>
- {% endlanguage %}
-{% endif %}
-</div>
-{% endcomment %}
-
-
-{% if object.image %}
- <img class="entry-picture" src="{% thumbnail object.image "250x300" as thumb %}
- {{ thumb.url }}
- {% empty %}
- {{ object.image.url }}
- {% endthumbnail %}" />
-{% endif %}
-<div class="lead">
-{{ object.lead }}
-</div>
+++ /dev/null
-{% extends "base.html" %}
-{% load url from future %}
-{% load i18n %}
-
-{% block "body" %}
-
-<h1>{% trans "Submit new story" %}</h1>
-
-<p class="form-info">{% blocktrans %}
-By submitting a story here, you agree to publish it under the terms of the
-<a href='http://creativecommons.org/licenses/by-sa/3.0/'>Creative Commons Attribution-Share Alike</a>
-free license.{% endblocktrans %}</p>
-
-<p class="form-info">{% blocktrans %}Stories are moderated, so please be
-patient, you'll be notified when it's published.{% endblocktrans %}</p>
-
-<form class="submit-form" method="post" action="{% url 'migdal_submit' %}">
-{% csrf_token %}
-<table>
- {{ submit_form.as_table }}
- <tr><td></td><td><button type="submit">{% trans "Submit" %}</button></td></tr>
-</table>
-</form>
-
-
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% extends "base.html" %}
-{% load i18n %}
-
-{% block "body" %}
-
-<h1>{% trans "Thanks for submitting" %}</h1>
-
-<p class="notice">
-{% 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 %}
-</p>
-
-
-
-{% endblock %}
\ No newline at end of file
+++ /dev/null
-{% load gravatar %}
-{% load markup_tags %}
-<ul id="latest-comments">
- {% for comment in object_list %}
- <li>
- <a href="{{ comment.get_absolute_url }}">
- <div class="title">{{ comment.content_object.title }}</div>
- <div class="author">{{ comment.name }}</div>
- <div class="body">{{ comment.comment|textile_restricted_pl|striptags|truncatewords:8 }}</div>
- </a>
- </li>
- {% endfor %}
-</ul>
\ No newline at end of file
+++ /dev/null
-{% 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
+++ /dev/null
-{% 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 }}
+++ /dev/null
-{% load i18n %}{{ entry.author }},
-
-Twój wpis został opublikowany:
-
-{% language 'pl' %}{{ entry.title }}
-http://{{ site.domain }}{{ entry.get_absolute_url }}{% endlanguage %}
-
-Dziękujemy!
-
---
-{{ site }}
+++ /dev/null
-{% load i18n %}
-{% for item in items %}
- <li{% if item.active %}
- class="active"{%endif %} {% if item.html_id %}
- id="{{ item.html_id}}"{% endif %}>
- <a href="{{ item.url }}">{{ item.title }}</a></li>
-{% endfor %}
+++ /dev/null
-{% extends "base.html" %}
-{% load url from future %}
-{% load i18n %}
-{% load migdal_tags %}
-{% load events_tags %}
-
-
-{% block "body" %}
-<h1>{% trans "Search results" %}</h1>
-
-{% 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 %}
-<p>{% trans "No results found." %}</p>
-{# Show some example queries to run, maybe query syntax, something else? #}
-{% endfor %}
-
-{% if page.has_previous or page.has_next %}
-<p class="prevnext">
- {% if page.has_previous %}
- <a class="previous_page" href="?q={{ query }}&page={{ page.previous_page_number }}">{% trans "previous" %}</a>
- {% endif %}
- {% if page.has_next %}
- <a class="next_page" href="?q={{ query }}&page={{ page.next_page_number }}">{% trans "next" %}</a>
- {% endif %}
-{% endif %}
-
-{% endblock "body" %}
+++ /dev/null
-# -*- 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.core.urlresolvers import reverse
-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(),
- }
-
-
-class MenuItem(object):
- html_id = None
-
- def __init__(self, title, url, html_id=None):
- self.title = title
- self.url = url
- self.html_id = html_id
-
- def check_active(self, chooser, value):
- self.active = chooser == 'url' and value == self.url
-
-
-class ModelMenuItem(object):
- def __init__(self, obj, title=None, html_id=None):
- self.obj = obj
- self.title = title or unicode(obj)
- self.url = obj.get_absolute_url()
- self.html_id = html_id
-
- def check_active(self, chooser, value):
- self.active = (chooser == 'object' and value == self.obj or
- chooser == 'objects' and self.obj in value)
-
-class CategoryMenuItem(ModelMenuItem):
- def check_active(self, chooser, value):
- super(CategoryMenuItem, self).check_active(chooser, value)
- self.active = (self.active or
- (chooser == 'object' and isinstance(value, Entry) and
- self.obj in value.categories.all()))
-
-
-class EntryTypeMenuItem(object):
- def __init__(self, title, type_, html_id=None):
- self.type = type_
- self.title = title
- self.url = reverse('migdal_entry_list_%s' % type_)
- self.html_id = html_id
-
- def check_active(self, chooser, value):
- self.active = (chooser == 'object' and isinstance(value, Entry)
- and value.type == self.type or
- chooser == 'entry_type' and value == self.type)
-
-@register.inclusion_tag('migdal/menu.html', takes_context=True)
-def main_menu(context, chooser=None, value=None):
- items = [
- ModelMenuItem(Entry.objects.get(slug_pl='o-nas')),
- EntryTypeMenuItem(_(u'Publications'), u'publications'),
- MenuItem(_(u'Events'), reverse('events')),
- CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'),
- title=_('Positions')),
- #CategoryMenuItem(Category.objects.get(slug_pl='pierwsza-pomoc'),
- # title=_('First aid in copyright')),
- ]
- #if context['request'].LANGUAGE_CODE == 'pl':
- # items.append(MenuItem(u'en', '/en/', html_id='item-lang'))
- #else:
- # items.append(MenuItem(u'pl', '/', html_id='item-lang'))
- for item in items:
- item.check_active(chooser, value)
- return {'items': items}
+++ /dev/null
-"""
-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)
+++ /dev/null
-# -*- 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 migdal.helpers 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<slug>[^/]+)/$'),
- 'migdal.views.entry', {'type_db': t.db},
- name='migdal_entry_%s' % t.db),
- ]
-
-
-# Disable en for now.
-urlpatterns = patterns('',
- url(r'^en/', handler404),
-)
-urlpatterns += i18n_patterns('',
- # main page
- url(r'^$', 'migdal.views.entry_list', 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<category_slug>[^/]*)/$'),
- 'migdal.views.entry_list', name='migdal_category'),
- url(string_concat(r'^', _('categories'), r'/(?P<category_slug>[^/]*)/rss.xml$'),
- feeds.EntriesFeed(), name='migdal_category_feed'),
- url(string_concat(r'^', _('search')), SearchPublishedView(), name='search'),
- # type-specific views
- *pats
-)
+++ /dev/null
-# -*- 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.shortcuts import get_object_or_404, render, redirect
-from django.utils.translation import get_language
-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 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
-
- 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, slug):
- lang = request.LANGUAGE_CODE
- args = {'type': type_db, 'slug_%s' % lang: slug}
- if not request.user.has_perm('migdal.change_entry'):
- args['published_%s' % lang] = True
- entry = get_object_or_404(Entry, **args)
-
- templates = ["migdal/entry/entry_detail.html"]
- if type_db 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
+++ /dev/null
-# -*- 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 textile import Textile
-
-
-class TextilePL(Textile):
- 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')
-
-
-class LazyUGettextLazy():
- """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))
-
-
-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
--- /dev/null
+from migdal.models import Category, Entry
+from menu.helpers import ObjectMenuItem, MenuItem, ModelMenuItem
+from django.core.urlresolvers import reverse_lazy
+from django.utils.translation import ugettext_lazy as _
+
+
+ITEMS = []
+
+def add_entry(**qs):
+ try:
+ entry = Entry.objects.get(**qs)
+ except Entry.DoesNotExist:
+ return
+ if not entry.published:
+ return
+ ITEMS.append(ObjectMenuItem(entry))
+
+add_entry(slug_pl='o-nas')
+
+ITEMS.append(ModelMenuItem(Entry, reverse_lazy('migdal_entry_list_publications'),
+ field_lookups={'type': 'publications'}, title=_('Publications')))
+
+ITEMS.append(MenuItem(reverse_lazy('events'), _('Events'),
+ more_urls=(reverse_lazy('events_past'),)))
+
+ITEMS.append(ObjectMenuItem(Category.objects.get(slug_pl='stanowisko'),
+ rev_lookups={Entry: 'categories'}, title=_('Positions')))
+#CategoryMenuItem(Category.objects.get(slug_pl='stanowisko'),
+# title=_('Positions')),
INSTALLED_APPS = (
'prawokultury',
+ 'fnpdjango',
+ 'menu',
'events',
'migdal',
},
}
-from django.conf import settings
-HAYSTACK_DOCUMENT_FIELD = "body_%s" % settings.LANGUAGE_CODE
+HAYSTACK_DOCUMENT_FIELD = "body_%s" % LANGUAGE_CODE
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
#'django.middleware.locale.LocaleMiddleware',
- 'migdal.middleware.URLLocaleMiddleware',
+ 'fnpdjango.middleware.URLLocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'pagination.middleware.PaginationMiddleware',
- 'realip_middleware.SetRemoteAddrFromXRealIP',
+ 'fnpdjango.middleware.SetRemoteAddrFromXRealIP',
)
-from prawokultury.helpers import textile_pl
+from fnpdjango.utils.text.textilepl import textile_pl
COMMENTS_APP = "django_comments_xtd"
COMMENTS_XTD_CONFIRM_EMAIL = False
+MENU_MODULE = 'prawokultury.menu_items'
<!DOCTYPE html>
{% load url from future %}
{% load i18n static %}
-{% load common_tags migdal_tags events_tags share %}
+{% load fnp_common menu_tags migdal_tags events_tags fnp_share fnp_lang %}
{% load compressed %}
<html prefix="og: http://ogp.me/ns#">
<head>
</div>
<ul id="menu" class="bar-left">
{% block "main_menu" %}
- {% main_menu 'url' request.get_full_path %}
+ {% main_menu %}
{% endblock %}
+ <!--li id="item-lang">{% lang_switcher %}</li-->
</ul>
<div style="clear: both;"></div>
</div>
+++ /dev/null
-{% if number or url %}
- {% load i18n %}
- <a class="next_page"
- {% if number %}
- href="?page={{ number }}"
- {% else %}
- href="{{ url }}"
- {% endif %}
- >
- {% if title %}
- {{ title }}
- {% else %}
- {% trans "next" %}
- {% endif %}
- </a>
-{% endif %}
\ No newline at end of file
+++ /dev/null
-{% if number or url %}
- {% load i18n %}
- <a class="previous_page"
- {% if number %}
- href="?page={{ number }}"
- {% else %}
- href="{{ url }}"
- {% endif %}
- >
- {% if title %}
- {{ title }}
- {% else %}
- {% trans "previous" %}
- {% endif %}
- </a>
-{% endif %}
\ No newline at end of file
+++ /dev/null
-{% load prevnext %}
-<p class="prevnext">
-{% next_page %}
-{% previous_page %}
-</p>
\ No newline at end of file
+++ /dev/null
-{% load i18n common_tags static %}
-{% with encoded_url=url|build_absolute_uri:request|urlencode encoded_desc=description|urlencode %}
-<a rel="nofollow" target="_blank" class="facebook"
- href="https://www.facebook.com/sharer.php?u={{ encoded_url }}"
- title="{% trans 'Share on Facebook' %}">
- <img src="{% static "img/social/"|add:iconset|add:"facebook.png" %}"
- alt="{% trans 'Share on Facebook' %}"></a>
-<a rel="nofollow" target="_blank" class="google"
- href="https://plus.google.com/share?url={{ encoded_url }}"
- title="{% trans 'Share on Google+' %}">
- <img src="{% static "img/social/"|add:iconset|add:"google.png" %}"
- alt="{% trans 'Share on Google+' %}"></a>
-<a rel="nofollow" target="_blank" class="twitter"
- href="https://twitter.com/intent/tweet?url={{ encoded_url }}&text={{ encoded_desc }}"
- title="{% trans 'Share on Twitter' %}">
- <img src="{% static "img/social/"|add:iconset|add:"twitter.png" %}"
- alt="{% trans 'Share on Twitter' %}"></a>
-<a rel="nofollow" target="_blank" class="nk"
- href="http://nk.pl/#sledzik?shout={{ encoded_desc }}%20{{ encoded_url }}"
- title="{% trans 'Share on NK.pl' %}">
- <img src="{% static "img/social/"|add:iconset|add:"nk.png" %}"
- alt="{% trans 'Share on NK.pl' %}"></a>
-{% comment %}
-<a rel="nofollow" target="_blank" class="diaspora"
- href="http://sharetodiaspora.github.com/?title={{ encoded_desc }}&url={{ encoded_url }}"
- title="{% trans 'Share on Diaspora' %}">
- <img src="{% static "img/social/"|add:iconset|add:"diaspora.png" %}"
- alt="{% trans 'Share on Diaspora' %}"></a>
-<a rel="nofollow" target="_blank" class="blip"
- href="http://blip.pl/dashboard?body={{ encoded_desc }}%20{{ encoded_url }}"
- title="{% trans 'Share on Blip.pl' %}">
- <img src="{% static "img/social/"|add:iconset|add:"blip.png" %}"
- alt="{% trans 'Share on Blip.pl' %}"></a>
-{% endcomment %}
-{% endwith %}
\ No newline at end of file
+++ /dev/null
-from django import template
-register = template.Library()
-
-
-@register.filter
-def build_absolute_uri(uri, request):
- return request.build_absolute_uri(uri)
+++ /dev/null
-# -*- 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 template
-from django.utils.safestring import mark_safe
-from prawokultury import helpers
-
-register = template.Library()
-
-
-@register.filter
-def textile_pl(node):
- return mark_safe(helpers.textile_pl(node))
-
-@register.filter
-def textile_restricted_pl(node):
- return mark_safe(helpers.textile_restricted_pl(node))
+++ /dev/null
-from django.template import Library
-
-register = Library()
-
-
-@register.inclusion_tag('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('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('prevnext/prevnext.html', takes_context=True)
-def prevnext(context):
- return context
+++ /dev/null
-from django.template import Library
-
-register = Library()
-
-
-@register.inclusion_tag('share.html', takes_context=True)
-def share(context, url, description, iconset=""):
- return {
- 'url': url,
- 'description': description,
- 'iconset': iconset,
- 'request': context['request'],
- }
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
-from migdal.helpers import i18n_patterns
-from migdal.urls import urlpatterns as migdal_urlpatterns
from django.utils.translation import ugettext_lazy as _, string_concat
+from fnpdjango.utils.urls import i18n_patterns
from events.urls import urlpatterns as events_urlpatterns
+from migdal.urls import urlpatterns as migdal_urlpatterns
admin.autodiscover()
+++ /dev/null
-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
sorl-thumbnail>=11.09,<12
django-pagination
+-e git+git://github.com/fnp/fnpdjango.git@9a5b05c52311da4f726fec29d8be7d173f695352#egg=fnpdjango
+-e git+git://github.com/fnp/django-migdal.git@734cd58d3f12c5397b42c1ae122c947500386014#egg=django-migdal
+
textile
django-markupfield
django-gravatar
+++ /dev/null
-# -*- 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')
-