From 2ff7d6d98d7ba61ce305fb2906bddaa37f320eb1 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 19 Jun 2013 14:11:30 +0200 Subject: [PATCH 1/1] Disallow link on book tags to avoid confusion. --- .../catalogue/locale/pl/LC_MESSAGES/django.mo | Bin 11193 -> 11414 bytes .../catalogue/locale/pl/LC_MESSAGES/django.po | 56 ++++++++++-------- apps/catalogue/models/tag.py | 8 ++- 3 files changed, 39 insertions(+), 25 deletions(-) diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index 4710d284df344d5841a291c5de111dcf919993b9..62671f11663db70a45c35272ade1e88c2a31b7f4 100644 GIT binary patch delta 3518 zcmY+_d2AGA7{~D!T8g z6f8tUK?z9I2&NGv5=0JBkwCbVi0}u92}pwA!KLy0+kG+mrq6!fd3WZ0pLyPy?aryI zr+H_a#nu?w8sa|UM65B#ad{jcwC@v*X^E$?0bWCWbql*-Y$IdpV-JkS-Z&PAVt=f{ zOx%yV@doPr9gQRNd1g1Ah75d(F?a-9;c;w%SFjVtHZkUY?1rszG%BGSoQg%5fcsDh z9Uz(Z^hn2;e#lLkVW@=0V=_*`=2(bI%tLZAZ=lZGg7@IZ zs6-E<61jr9{-zyoloYK{CaR)CFp2feR65EifGSPMo-hZM`3ls8>rr?10V>f?P}l86 zUH27IU2_E6;*Y2b-9dKM#5RkbABXpH+yp&koPoWk*W5+Mqaqka0%J>dyp~h^u z7D`4vWNlGf(jBRq8G>3U3-vHgMCtxV0%&LFW?>1giBC&yaF}84k@O27s?Z0A$d9UjKbc)}jfr;b{9Au97~9F6bcV7!Xj zlC;jz3HzZ+J|3^(4AfRmOo=)JdHzfhK80QtoqBXGVtxDtRf+4!wI+rK;(Q&p0F`m$ zZqbQ4pzb&w$-xXkEu4$9u?#iu&!_~i*zf;D&EJsy<5}=bOFB9s#hQWIyMfjb*72wd zr(i7Rp%y4YB{tiRFGkI`4CAo|`4u-CQ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RZQ=Nm6TrWiJ`6kr;^{9T1 zpjPZ1)E0bZ{RZ`bw;d|oRPNe_qw(&*U8tGAhq-tOvoVx))|MmLeSa%p~FuUTgtsfK=979nM9)$3@5(W;JTy{kRoh zLv>Y4WQJXgmoqN2T9X)U*IL49!-`eFlWfF{($T5bDr4B+|{ z2I2>(J?=x@cMa8lKkB}_=#O3;s3^Vv0aUctiKrXWa0q7E_8io}g|>Y$Y9*GVI;ucT za2x80ccKs0+xAA(_nT4uzKWXAQS@Pa(?dlaogM^(iJcOqt zSoM9ChsmR!n)_!SJVA80pLUx}ja7I}Z}}@A(%D0G4p~bcA#Fr2lFCk^=TRvq-b6=A z&#;83yi9bwV#q9_vXqP`6Lmq+8mQ>Ewc1m2{|x0<$h1-l|)DMMWWJ97I1{fE#VS%=#QY zW$TY)F_}b`lRBc3?qZrzzaA=+iT-_DP4<%=B#w-5PrLj7KLIq{D^2$*)-ZgDY_iu` qy%&ddd-t9XetoEaT1;x%jEu~d4Uw^KeM&~}p~z03-eb}I!~O-klp53k diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.po b/apps/catalogue/locale/pl/LC_MESSAGES/django.po index 13f11dccb..a2d12acae 100644 --- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-06-12 12:48+0200\n" -"PO-Revision-Date: 2013-06-12 12:54+0100\n" +"POT-Creation-Date: 2013-06-19 14:10+0200\n" +"PO-Revision-Date: 2013-06-19 14:10+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" @@ -74,7 +74,7 @@ msgstr "Duży" msgid "Queue is full. Please try again later." msgstr "Kolejka jest pełna. Proszę spróbować ponownie później." -#: views.py:527 +#: views.py:521 #, python-format msgid "" "An error occurred: %(exception)s\n" @@ -85,20 +85,20 @@ msgstr "" "\n" "%(tb)s" -#: views.py:528 +#: views.py:522 msgid "Book imported successfully" msgstr "Książka zaimportowana" -#: views.py:530 +#: views.py:524 #, python-format msgid "Error importing file: %r" msgstr "Błąd podczas importowania pliku: %r" -#: views.py:562 +#: views.py:556 msgid "Download custom PDF" msgstr "Stwórz własny PDF" -#: views.py:563 templates/catalogue/book_short.html:92 +#: views.py:557 templates/catalogue/book_short.html:92 #: templates/catalogue/book_text.html:27 templates/catalogue/book_wide.html:63 msgid "Download" msgstr "Pobierz" @@ -107,12 +107,12 @@ msgstr "Pobierz" msgid "title" msgstr "tytuł" -#: models/book.py:29 models/tag.py:31 +#: models/book.py:29 models/tag.py:32 msgid "sort key" msgstr "klucz sortowania" #: models/book.py:30 models/book.py:32 models/collection.py:12 -#: models/collection.py:15 models/tag.py:30 +#: models/collection.py:15 models/tag.py:31 msgid "slug" msgstr "slug" @@ -121,12 +121,12 @@ msgid "language code" msgstr "Kod języka" #: models/book.py:35 models/book.py:145 models/collection.py:13 -#: models/tag.py:34 models/tag.py:83 +#: models/tag.py:35 models/tag.py:89 msgid "description" msgstr "opis" -#: models/book.py:36 models/book.py:37 models/bookmedia.py:29 models/tag.py:41 -#: models/tag.py:42 +#: models/book.py:36 models/book.py:37 models/bookmedia.py:29 models/tag.py:42 +#: models/tag.py:43 msgid "creation date" msgstr "data utworzenia" @@ -142,7 +142,7 @@ msgstr "dodatkowe informacje" msgid "cover" msgstr "okładka" -#: models/book.py:66 models/tag.py:20 +#: models/book.py:66 models/tag.py:21 msgid "book" msgstr "książka" @@ -169,7 +169,7 @@ msgstr "plik %s" msgid "type" msgstr "typ" -#: models/bookmedia.py:27 models/tag.py:29 +#: models/bookmedia.py:27 models/tag.py:30 msgid "name" msgstr "nazwa" @@ -201,46 +201,54 @@ msgstr "fragment" msgid "fragments" msgstr "fragmenty" -#: models/tag.py:14 +#: models/tag.py:15 msgid "author" msgstr "autor" -#: models/tag.py:15 +#: models/tag.py:16 msgid "epoch" msgstr "epoka" -#: models/tag.py:16 +#: models/tag.py:17 msgid "kind" msgstr "rodzaj" -#: models/tag.py:17 +#: models/tag.py:18 msgid "genre" msgstr "gatunek" -#: models/tag.py:18 +#: models/tag.py:19 msgid "theme" msgstr "motyw" -#: models/tag.py:19 +#: models/tag.py:20 msgid "set" msgstr "półka" -#: models/tag.py:32 +#: models/tag.py:33 msgid "category" msgstr "kategoria" -#: models/tag.py:37 +#: models/tag.py:38 msgid "book count" msgstr "liczba książek" -#: models/tag.py:59 +#: models/tag.py:60 msgid "tag" msgstr "tag" -#: models/tag.py:60 +#: models/tag.py:61 msgid "tags" msgstr "tagi" +#: models/tag.py:78 +msgid "" +"Book tags can't have attached links. Set them directly on the book instead " +"of it's tag." +msgstr "" +"Tagi typu książka nie mogą mieć ustawionych linków. Ustaw je bezpośrednio " +"dla książki, zamiast dla jej tagu." + #: templates/catalogue/audiobook_list.html:7 #: templates/catalogue/audiobook_list.html:16 msgid "Listing of all audiobooks" diff --git a/apps/catalogue/models/tag.py b/apps/catalogue/models/tag.py index f7c5356a7..b0c75fbb4 100644 --- a/apps/catalogue/models/tag.py +++ b/apps/catalogue/models/tag.py @@ -3,9 +3,10 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.contrib.auth.models import User +from django.core.exceptions import ValidationError from django.db import models from django.db.models import permalink -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext, ugettext_lazy as _ from newtagging.models import TagBase @@ -71,6 +72,11 @@ class Tag(TagBase): def get_absolute_url(self): return ('catalogue.views.tagged_object_list', [self.url_chunk]) + def clean(self): + if self.category == 'book' and (self.gazeta_link or self.wiki_link): + raise ValidationError(ugettext( + u"Book tags can't have attached links. Set them directly on the book instead of it's tag.")) + @classmethod @permalink def create_url(cls, category, slug): -- 2.20.1