From: Jan Szejko Date: Tue, 10 Jul 2018 09:57:43 +0000 (+0200) Subject: new fields: gallery, time/place for events X-Git-Tag: 0.7.6 X-Git-Url: https://git.mdrn.pl/django-migdal.git/commitdiff_plain/336f39228c9206e9ff728b65f14d838076452a13?hp=d57965a38ccf06862015247092906eaa90fcfb5a new fields: gallery, time/place for events --- diff --git a/migdal/__init__.py b/migdal/__init__.py index cfe66c7..e785125 100644 --- a/migdal/__init__.py +++ b/migdal/__init__.py @@ -17,6 +17,7 @@ class Settings(AppSettings): EntryType('news', _('news'), commentable=True, on_main=True, promotable=True), EntryType('publications', _('publications')), EntryType('info', _('info')), + EntryType('event', _('events')), ) TYPE_SUBMIT = 'news' TAXONOMIES = ( diff --git a/migdal/admin.py b/migdal/admin.py index a03d16c..cf1c514 100644 --- a/migdal/admin.py +++ b/migdal/admin.py @@ -46,7 +46,7 @@ def filtered_entry_admin(typ): (None, { 'fields': _promo_if_necessary + ( 'in_stream', 'author', 'author_email', 'canonical_url', 'image', - 'date', 'first_published_at', 'changed_at') + 'date', 'first_published_at', 'changed_at', 'gallery') }), ) + tuple( (ln, {'fields': ( @@ -56,6 +56,8 @@ def filtered_entry_admin(typ): 'slug_%s' % lc, 'lead_%s' % lc, 'body_%s' % lc, + 'place_%s' % lc, + 'time_%s' % lc, )}) for lc, ln in app_settings.OBLIGATORY_LANGUAGES ) + tuple( @@ -66,6 +68,8 @@ def filtered_entry_admin(typ): 'slug_%s' % lc, 'lead_%s' % lc, 'body_%s' % lc, + 'place_%s' % lc, + 'time_%s' % lc, )}) for lc, ln in app_settings.OPTIONAL_LANGUAGES ) diff --git a/migdal/locale/pl/LC_MESSAGES/django.mo b/migdal/locale/pl/LC_MESSAGES/django.mo index bb9c276..ebb7092 100644 Binary files a/migdal/locale/pl/LC_MESSAGES/django.mo and b/migdal/locale/pl/LC_MESSAGES/django.mo differ diff --git a/migdal/locale/pl/LC_MESSAGES/django.po b/migdal/locale/pl/LC_MESSAGES/django.po index 2296f04..55bf93d 100644 --- a/migdal/locale/pl/LC_MESSAGES/django.po +++ b/migdal/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ 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" +"POT-Creation-Date: 2018-07-09 14:54+0000\n" "PO-Revision-Date: 2012-12-11 13:32+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: FNP \n" @@ -15,7 +15,8 @@ msgstr "" "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" +"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 @@ -38,7 +39,7 @@ msgstr "tematy" msgid "types" msgstr "rodzaje" -#: admin.py:44 +#: admin.py:75 msgid "Categories" msgstr "Kategorie" @@ -46,8 +47,7 @@ msgstr "Kategorie" msgid "latest" msgstr "ostatnie" -#: feeds.py:32 -#: models.py:56 +#: feeds.py:32 models.py:85 msgid "entries" msgstr "wpisy" @@ -63,130 +63,129 @@ msgstr "Tytuł" msgid "Content" msgstr "Treść" -#: models.py:20 +#: models.py:22 msgid "taxonomy" msgstr "taksonomia" -#: models.py:24 +#: models.py:25 msgid "category" msgstr "kategoria" -#: models.py:25 -#: models.py:52 -#: urls.py:41 -#: urls.py:43 +#: models.py:26 models.py:75 urls.py:39 urls.py:41 msgid "categories" msgstr "kategorie" -#: models.py:45 +#: models.py:58 models.py:72 +msgid "image" +msgstr "obrazek" + +#: models.py:66 msgid "created at" msgstr "data utworzenia" -#: models.py:46 +#: models.py:67 msgid "changed at" msgstr "data ostatniej zmiany" -#: models.py:47 +#: models.py:68 msgid "author" msgstr "autor" -#: models.py:48 +#: models.py:70 msgid "author email" msgstr "e-mail autora" -#: models.py:49 +#: models.py:71 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 +#: models.py:73 msgid "promoted" msgstr "promowane" -#: models.py:55 -#: models.py:63 +#: models.py:74 +msgid "in stream" +msgstr "" + +#: models.py:76 models.py:160 +msgid "published at" +msgstr "data publikacji" + +#: models.py:77 msgid "canonical link" msgstr "link kanoniczny" +#: models.py:84 msgid "entry" msgstr "wpis" -#: models.py:80 +#: models.py:110 #, 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 +#: models.py:129 #, python-format msgid "Your story has been published at %s." msgstr "Twój wpis został opublikowany na stronie %s." -#: models.py:105 +#: models.py:141 msgid "needed" msgstr "potrzebne" -#: models.py:106 +#: models.py:142 msgid "Unneeded" msgstr "Niepotrzebne" -#: models.py:106 +#: models.py:142 msgid "Needed" msgstr "Potrzebne" -#: models.py:106 +#: models.py:142 msgid "Done" msgstr "Ukończone" -#: models.py:112 +#: models.py:146 +msgid "" +"Use Textile syntax." +msgstr "" +"Włączona składnia Textile." + +#: models.py:150 msgid "title" msgstr "tytuł" -#: models.py:113 +#: models.py:152 msgid "lead" msgstr "lead" -#: models.py:114 -#: models.py:116 -msgid "Use Textile syntax." -msgstr "Włączona składnia Textile." - -#: models.py:115 +#: models.py:154 msgid "body" msgstr "treść" -#: models.py:117 +#: models.py:156 +msgid "place" +msgstr "miejsce" + +#: models.py:158 +msgid "time" +msgstr "czas" + +#: models.py:159 msgid "published" msgstr "opublikowane" -#: models.py:118 -msgid "published at" -msgstr "data publikacji" - -#: models.py:123 +#: models.py:165 msgid "file" msgstr "plik" -#: models.py:141 +#: models.py:181 #, 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" @@ -203,22 +202,26 @@ msgstr "Podgląd" msgid "Comments" msgstr "Komentarze" -#: templates/comments/migdal/entry/preview.html:26 +#: templates/comments/migdal/entry/preview.html:21 msgid "Preview your comment" msgstr "Podgląd komentarza" -#: templates/migdal/entry/entry_detail.html:27 +#: templates/migdal/entry/entry_detail.html:26 msgid "This entry hasn't been published yet." msgstr "Ten wpis nie został jeszcze opublikowany." -#: templates/migdal/entry/entry_list.html:22 +#: templates/migdal/entry/entry_list.html:13 msgid "Category" msgstr "Kategoria" -#: templates/migdal/entry/entry_list.html:55 +#: templates/migdal/entry/entry_list.html:42 msgid "Submit a new story, create Right to Culture with us!" msgstr "Dodaj nowy wpis, twórz Prawo Kultury razem z nami!" +#: templates/migdal/entry/entry_list.html:47 +msgid "Work in progress." +msgstr "" + #: templates/migdal/entry/entry_short.html:19 #, python-format msgid "%(c)s comment" @@ -231,28 +234,31 @@ msgstr[2] "%(c)s komentarzy" msgid "read more" msgstr "czytaj więcej" -#: templates/migdal/entry/submit.html:7 +#: templates/migdal/entry/submit.html:6 msgid "Submit new story" msgstr "Dodaj nowy wpis" -#: templates/migdal/entry/submit.html:9 +#: templates/migdal/entry/submit.html:8 msgid "" "\n" "By submitting a story here, you agree to publish it under the terms of the\n" -"Creative Commons Attribution-Share Alike\n" +"Creative Commons " +"Attribution-Share Alike\n" "free license." msgstr "" "\n" "Dodając wpis, zgadzasz się najego publikację na warunkach wolnej licencji\n" -"Creative Commons Uznanie autorstwa – Na tych samych warunkach." +"Creative " +"Commons Uznanie autorstwa – Na tych samych warunkach." -#: templates/migdal/entry/submit.html:14 +#: templates/migdal/entry/submit.html:13 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." +msgstr "" +"Wpisy są moderowane. Bądź cierpliwy, otrzymasz powiadomienie o publikacji." -#: templates/migdal/entry/submit.html:21 +#: templates/migdal/entry/submit.html:20 msgid "Submit" msgstr "Wyślij" @@ -268,38 +274,48 @@ msgid "" "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" +"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 +#: templates/search/search.html:8 msgid "Search results" msgstr "Wyniki wyszukiwania" -#: templates/search/search.html:18 +#: templates/search/search.html:17 msgid "No results found." msgstr "Brak wyników." -#: templates/search/search.html:25 +#: templates/search/search.html:24 msgid "previous" msgstr "poprzednie" -#: templates/search/search.html:28 +#: templates/search/search.html:27 msgid "next" msgstr "następne" -#: templatetags/migdal_tags.py:128 -msgid "Publications" -msgstr "Publikacje" +#: urls.py:35 urls.py:36 +msgid "submit" +msgstr "wyslij" + +#: urls.py:36 +msgid "thanks" +msgstr "dzieki" + +#: urls.py:43 +msgid "search" +msgstr "szukaj" + +#~ msgid "Publications" +#~ msgstr "Publikacje" -#: templatetags/migdal_tags.py:129 -msgid "Events" -msgstr "Wydarzenia" +#~ msgid "Events" +#~ msgstr "Wydarzenia" -#: templatetags/migdal_tags.py:131 -msgid "Positions" -msgstr "Stanowiska" +#~ 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" diff --git a/migdal/migrations/0002_auto_20180710_0849.py b/migdal/migrations/0002_auto_20180710_0849.py new file mode 100644 index 0000000..bc1c056 --- /dev/null +++ b/migdal/migrations/0002_auto_20180710_0849.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2018-07-10 08:49 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion +import fnpdjango.utils.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('migdal', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Photo', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image', models.ImageField(blank=True, null=True, upload_to=b'entry/photo/', verbose_name='image')), + ], + ), + migrations.CreateModel( + name='PhotoGallery', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('key', models.CharField(max_length=64)), + ], + ), + migrations.CreateModel( + name='Entry_event', + fields=[ + ], + options={ + 'verbose_name': 'entry: events', + 'proxy': True, + 'verbose_name_plural': 'entries: events', + }, + bases=('migdal.entry',), + ), + migrations.AddField( + model_name='entry', + name='place_en', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='place'), + ), + migrations.AddField( + model_name='entry', + name='place_pl', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='place'), + ), + migrations.AddField( + model_name='entry', + name='time_en', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='time'), + ), + migrations.AddField( + model_name='entry', + name='time_pl', + field=models.CharField(blank=True, max_length=256, null=True, verbose_name='time'), + ), + migrations.AlterField( + model_name='entry', + name='body_en', + field=fnpdjango.utils.fields.TextileField(blank=True, help_text='Use Textile syntax.', null=True, rendered_field=True, verbose_name='body'), + ), + migrations.AlterField( + model_name='entry', + name='body_pl', + field=fnpdjango.utils.fields.TextileField(blank=True, help_text='Use Textile syntax.', null=True, rendered_field=True, verbose_name='body'), + ), + migrations.AlterField( + model_name='entry', + name='lead_en', + field=fnpdjango.utils.fields.TextileField(blank=True, help_text='Use Textile syntax.', null=True, rendered_field=True, verbose_name='lead'), + ), + migrations.AlterField( + model_name='entry', + name='lead_pl', + field=fnpdjango.utils.fields.TextileField(blank=True, help_text='Use Textile syntax.', null=True, rendered_field=True, verbose_name='lead'), + ), + migrations.AlterField( + model_name='entry', + name='type', + field=models.CharField(choices=[(b'news', 'news'), (b'publications', 'publications'), (b'info', 'info'), (b'event', 'events')], db_index=True, max_length=16), + ), + migrations.AddField( + model_name='photo', + name='gallery', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='migdal.PhotoGallery'), + ), + migrations.AddField( + model_name='entry', + name='gallery', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='migdal.PhotoGallery'), + ), + ] diff --git a/migdal/models.py b/migdal/models.py index d0b16c0..89a194d 100644 --- a/migdal/models.py +++ b/migdal/models.py @@ -12,7 +12,7 @@ from django.db import models from django.template import loader, Context from django.utils.translation import ugettext_lazy as _, ugettext from django_comments_xtd.models import XtdComment -from markupfield.fields import MarkupField +from fnpdjango.utils.fields import TextileField from fnpdjango.utils.models.translation import add_translatable, tQ from migdal import app_settings from migdal.fields import SlugNullField @@ -46,6 +46,18 @@ class PublishedEntryManager(models.Manager): ) +class PhotoGallery(models.Model): + key = models.CharField(max_length=64) + + def __unicode__(self): + return self.key + + +class Photo(models.Model): + gallery = models.ForeignKey(PhotoGallery) + image = models.ImageField(_('image'), upload_to='entry/photo/', null=True, blank=True) + + class Entry(models.Model): type = models.CharField( max_length=16, @@ -63,6 +75,7 @@ class Entry(models.Model): categories = models.ManyToManyField(Category, blank=True, verbose_name=_('categories')) first_published_at = models.DateTimeField(_('published at'), null=True, blank=True) canonical_url = models.URLField(_('canonical link'), null=True, blank=True) + gallery = models.ForeignKey(PhotoGallery, null=True, blank=True) objects = models.Manager() published_objects = PublishedEntryManager() @@ -130,15 +143,17 @@ add_translatable(Entry, languages=app_settings.OPTIONAL_LANGUAGES, fields={ default='n'), }) +TEXTILE_HELP = _('Use Textile syntax.') + add_translatable(Entry, { 'slug': SlugNullField(unique=True, db_index=True, null=True, blank=True), 'title': models.CharField(_('title'), max_length=255, null=True, blank=True), - 'lead': MarkupField( - _('lead'), markup_type='textile_pl', null=True, blank=True, - help_text=_('Use Textile syntax.')), - 'body': MarkupField( - _('body'), markup_type='textile_pl', null=True, blank=True, - help_text=_('Use Textile syntax.')), + 'lead': TextileField( + _('lead'), markup_type='textile_pl', null=True, blank=True, help_text=TEXTILE_HELP), + 'body': TextileField( + _('body'), markup_type='textile_pl', null=True, blank=True, help_text=TEXTILE_HELP), + 'place': models.CharField(_('place'), null=True, blank=True, max_length=256), + 'time': models.CharField(_('time'), null=True, blank=True, max_length=256), 'published': models.BooleanField(_('published'), default=False), 'published_at': models.DateTimeField(_('published at'), null=True, blank=True), }) diff --git a/migdal/templates/migdal/entry/event/entry_begin.html b/migdal/templates/migdal/entry/event/entry_begin.html new file mode 100644 index 0000000..03f4356 --- /dev/null +++ b/migdal/templates/migdal/entry/event/entry_begin.html @@ -0,0 +1,28 @@ +{% load i18n %} +{% load thumbnail %} + +{% if detail %} +

{{ object.title }}

+{% else %} +

{{ object.title }}

+{% endif %} + + +{% if object.image %} + + + +{% endif %} +
+{{ object.lead }} +
+{% if object.place %} + {{ object.place }} +{% endif %} +{% if object.time %} + {{ object.time }} +{% endif %} diff --git a/setup.py b/setup.py index a6136b2..ccd67ba 100755 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ def whole_trees(package_dir, paths): setup( name='django-migdal', - version='0.7.5', + version='0.7.6', author='Radek Czajka', author_email='radoslaw.czajka@nowoczesnapolska.org.pl', maintainer='Jan Szejko',