From 336f39228c9206e9ff728b65f14d838076452a13 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 10 Jul 2018 11:57:43 +0200 Subject: [PATCH] new fields: gallery, time/place for events --- migdal/__init__.py | 1 + migdal/admin.py | 6 +- migdal/locale/pl/LC_MESSAGES/django.mo | Bin 4539 -> 4679 bytes migdal/locale/pl/LC_MESSAGES/django.po | 182 ++++++++++-------- migdal/migrations/0002_auto_20180710_0849.py | 97 ++++++++++ migdal/models.py | 29 ++- .../migdal/entry/event/entry_begin.html | 28 +++ setup.py | 2 +- 8 files changed, 253 insertions(+), 92 deletions(-) create mode 100644 migdal/migrations/0002_auto_20180710_0849.py create mode 100644 migdal/templates/migdal/entry/event/entry_begin.html 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_LANGUAG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cy+aNYw#)3w|i}VKyGpKs2y0c`Y-!GgYB!Q-G|!AHZone zA2qQfIqZKPg>D+!a0peO!hJZ4x}lKK8?g*Ekwauf7{O{hk6PgbYKJDV1E*1Ep2GuD zkDaImUqI&QM!oF61{kA(Yuz|%h4;({sE6vY{r?8l!AH~?e=)zJ`uUDJYdzZfKO42u zT&owM`Y%ECQx&s@0BS2+t=?|+4%CW{q9%A8*%Wsgwc?BBWz_v~tB;$v&AX@xCXka( z-dl@${*q}uc^MHP3W)|nGt_bDb*v+l)Ja9M^!G^g3M%Q9Qqtst#C9S~R1u|wj%hg+ zQ_!M98sA4jTcz{dL@>eRSwZss-+@~RtxiXwkB`!pzx>NvDCxseK=2K7&4jjkIaN~7 zH?77RHei<9&HHT)n@yb;$C!LTtSPzmC01F7#n+IuQ8 z*gMeIGZ^iTM(U3Z^am0dnOQ0ELQhwG*wf=}tP8f*g_=u4p>Qx%6KqH\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', -- 2.20.1