From: Radek Czajka Date: Mon, 22 Jul 2013 11:34:51 +0000 (+0200) Subject: Merge branch 'master' into ofop X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/9c90640199aa690235670f01d842e11386ded0ac?hp=bbc3c64053f2e93c49f133bf8fc1243e470ef5e8 Merge branch 'master' into ofop Conflicts: apps/toolbar/fixtures/initial_toolbar.yaml redakcja/static/xsl/wl2html_client.xsl --- diff --git a/.gitignore b/.gitignore index 0d555842..318e02d0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ dev.sqlite requirements.pybundle *~ *.orig +/redakcja/media +/static +.sass-cache # Python garbage *.pyc @@ -26,5 +29,8 @@ nbproject/* .project .pydevproject .settings -platforma/static/compressed -platforma/static/compressed/* + +node_modules + +/static_test +chromedriver.log \ No newline at end of file diff --git a/.gitmodules b/.gitmodules index 56b9c425..004f6f37 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "lib/librarian"] path = lib/librarian - url = git://github.com/fnp/librarian.git + url = git://git.nowoczesnapolska.org.pl/librarian.git diff --git a/README.md b/README.md index 47fad0c8..93ffb1c4 100644 --- a/README.md +++ b/README.md @@ -38,3 +38,14 @@ Wdrożenie fab production deploy +Testy +==== + + $ pip install -r requirements-test.txt + $ python redakcja/manage.py test --settings=settings.test + +JavaScript (wymagany node.js i xsltproc): + + $ npm install + $ ./node_modules/.bin/mocha -u tdd $(find -name *_test.js) + \ No newline at end of file diff --git a/apps/apiclient/urls.py b/apps/apiclient/urls.py index 87d9997d..55cc4669 100755 --- a/apps/apiclient/urls.py +++ b/apps/apiclient/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url urlpatterns = patterns('apiclient.views', url(r'^oauth/$', 'oauth', name='apiclient_oauth'), diff --git a/apps/catalogue/admin.py b/apps/catalogue/admin.py index a3faa98e..7fbacad9 100644 --- a/apps/catalogue/admin.py +++ b/apps/catalogue/admin.py @@ -3,10 +3,13 @@ from django.contrib import admin from catalogue import models class BookAdmin(admin.ModelAdmin): + list_display = ['title', 'public', '_published', '_new_publishable', 'project'] + list_filter = ['public', '_published', '_new_publishable', 'project'] prepopulated_fields = {'slug': ['title']} search_fields = ['title'] +admin.site.register(models.Project) admin.site.register(models.Book, BookAdmin) admin.site.register(models.Chunk) diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index f70dc472..7ae7ff40 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -20,7 +20,7 @@ class DocumentCreateForm(forms.ModelForm): class Meta: model = Book - exclude = ['parent', 'parent_number'] + exclude = ['parent', 'parent_number', 'project'] def __init__(self, *args, **kwargs): super(DocumentCreateForm, self).__init__(*args, **kwargs) @@ -130,6 +130,7 @@ class BookForm(forms.ModelForm): class Meta: model = Book + exclude = ['project'] def __init__(self, *args, **kwargs): ret = super(BookForm, self).__init__(*args, **kwargs) diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index 71a8b91e..b6a12e32 100644 Binary files a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo and b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo differ diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.po b/apps/catalogue/locale/pl/LC_MESSAGES/django.po index 4a898d66..6790400c 100644 --- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po @@ -7,15 +7,18 @@ msgid "" msgstr "" "Project-Id-Version: Platforma Redakcyjna\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-06-18 12:52+0200\n" -"PO-Revision-Date: 2012-06-18 12:53+0100\n" +"POT-Creation-Date: 2013-07-16 13:22+0200\n" +"PO-Revision-Date: 2013-07-16 13:22+0100\n" "Last-Translator: Radek Czajka \n" -"Language-Team: Fundacja Nowoczesna Polska \n" +"Language-Team: Fundacja Nowoczesna Polska \n" "Language: pl\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" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2);\n" +"X-Generator: Poedit 1.5.4\n" #: forms.py:39 msgid "Text file must be UTF-8 encoded." @@ -37,8 +40,7 @@ msgstr "Katalogi zawierają dokumenty w częściach" msgid "Assigned to" msgstr "Przypisane do" -#: forms.py:97 -#: forms.py:111 +#: forms.py:97 forms.py:111 msgid "Chunk with this slug already exists" msgstr "Część z tym slugiem już istnieje" @@ -59,63 +61,63 @@ msgstr "Dokument o tym slugu już istnieje w repozytorium." msgid "File should be UTF-8 encoded." msgstr "Plik powinien mieć kodowanie UTF-8." -#: models/book.py:27 -#: models/chunk.py:23 +#: views.py:498 models/book.py:56 +msgid "books" +msgstr "książki" + +#: views.py:500 +msgid "scan gallery" +msgstr "galeria skanów" + +#: models/book.py:28 models/chunk.py:23 msgid "title" msgstr "tytuł" -#: models/book.py:28 -#: models/chunk.py:24 +#: models/book.py:29 models/chunk.py:24 msgid "slug" msgstr "slug" -#: models/book.py:29 +#: models/book.py:30 msgid "public" msgstr "publiczna" -#: models/book.py:30 +#: models/book.py:31 msgid "scan gallery name" msgstr "nazwa galerii skanów" -#: models/book.py:33 +#: models/book.py:35 msgid "parent" msgstr "rodzic" -#: models/book.py:34 +#: models/book.py:36 msgid "parent number" msgstr "numeracja rodzica" -#: models/book.py:51 -#: models/chunk.py:21 -#: models/publish_log.py:17 +#: models/book.py:55 models/chunk.py:21 models/publish_log.py:17 msgid "book" msgstr "książka" -#: models/book.py:52 -msgid "books" -msgstr "książki" - -#: models/book.py:250 +#: models/book.py:255 msgid "No chunks in the book." msgstr "Książka nie ma części." -#: models/book.py:254 +#: models/book.py:259 msgid "Not all chunks have publishable revisions." msgstr "Niektóre części nie są gotowe do publikacji." -#: models/book.py:263 +#: models/book.py:266 msgid "Invalid XML" msgstr "Nieprawidłowy XML" -#: models/book.py:265 +#: models/book.py:268 msgid "No Dublin Core found." msgstr "Brak sekcji Dublin Core." -#: models/book.py:267 +#: models/book.py:270 msgid "Invalid Dublin Core" msgstr "Nieprawidłowy Dublin Core" -#: models/book.py:270 +#: models/book.py:273 msgid "rdf:about is not" msgstr "rdf:about jest różny od" @@ -135,17 +137,31 @@ msgstr "część" msgid "chunks" msgstr "części" +#: models/project.py:13 +msgid "name" +msgstr "nazwa" + +#: models/project.py:14 +msgid "notes" +msgstr "notatki" + +#: models/project.py:19 templates/catalogue/book_list/book_list.html:62 +msgid "project" +msgstr "projekt" + +#: models/project.py:20 +msgid "projects" +msgstr "projekty" + #: models/publish_log.py:18 msgid "time" msgstr "czas" -#: models/publish_log.py:19 -#: templates/catalogue/wall.html:18 +#: models/publish_log.py:19 templates/catalogue/wall.html:18 msgid "user" msgstr "użytkownik" -#: models/publish_log.py:24 -#: models/publish_log.py:33 +#: models/publish_log.py:24 models/publish_log.py:33 msgid "book publish record" msgstr "zapis publikacji książki" @@ -165,8 +181,7 @@ msgstr "zapis publikacji części" msgid "chunk publish records" msgstr "zapisy publikacji części" -#: templates/catalogue/activity.html:10 -#: templatetags/catalogue.py:29 +#: templates/catalogue/activity.html:9 templatetags/catalogue.py:29 msgid "Activity" msgstr "Aktywność" @@ -179,61 +194,63 @@ msgid "Append book" msgstr "Dołącz książkę" #: templates/catalogue/book_detail.html:14 -#: templates/catalogue/book_edit.html:9 -#: templates/catalogue/chunk_edit.html:13 +#: templates/catalogue/book_edit.html:9 templates/catalogue/chunk_edit.html:12 msgid "Save" msgstr "Zapisz" #: templates/catalogue/book_detail.html:21 +msgid "Edit gallery" +msgstr "Edytuj galerię" + +#: templates/catalogue/book_detail.html:24 msgid "Append to other book" msgstr "Dołącz do innej książki" -#: templates/catalogue/book_detail.html:27 +#: templates/catalogue/book_detail.html:30 msgid "Chunks" msgstr "Części" -#: templates/catalogue/book_detail.html:42 -#: templatetags/wall.py:78 +#: templates/catalogue/book_detail.html:45 templatetags/wall.py:78 msgid "Publication" msgstr "Publikacja" -#: templates/catalogue/book_detail.html:46 +#: templates/catalogue/book_detail.html:54 msgid "Last published" msgstr "Ostatnio opublikowano" -#: templates/catalogue/book_detail.html:56 +#: templates/catalogue/book_detail.html:64 msgid "Full XML" msgstr "Pełny XML" -#: templates/catalogue/book_detail.html:57 +#: templates/catalogue/book_detail.html:65 msgid "HTML version" msgstr "Wersja HTML" -#: templates/catalogue/book_detail.html:58 +#: templates/catalogue/book_detail.html:66 msgid "TXT version" msgstr "Wersja TXT" -#: templates/catalogue/book_detail.html:59 +#: templates/catalogue/book_detail.html:67 msgid "PDF version" msgstr "Wersja PDF" -#: templates/catalogue/book_detail.html:60 +#: templates/catalogue/book_detail.html:68 msgid "EPUB version" msgstr "Wersja EPUB" -#: templates/catalogue/book_detail.html:73 +#: templates/catalogue/book_detail.html:81 msgid "Publish" msgstr "Opublikuj" -#: templates/catalogue/book_detail.html:77 +#: templates/catalogue/book_detail.html:85 msgid "Log in to publish." msgstr "Zaloguj się, aby opublikować." -#: templates/catalogue/book_detail.html:80 +#: templates/catalogue/book_detail.html:88 msgid "This book can't be published yet, because:" msgstr "Ta książka nie może jeszcze zostać opublikowana. Powód:" -#: templates/catalogue/book_detail.html:90 +#: templates/catalogue/book_detail.html:98 msgid "Comments" msgstr "Komentarze" @@ -249,8 +266,7 @@ msgstr "Spis treści" msgid "Edit. note" msgstr "Nota red." -#: templates/catalogue/chunk_add.html:5 -#: templates/catalogue/chunk_edit.html:19 +#: templates/catalogue/chunk_add.html:5 templates/catalogue/chunk_edit.html:18 msgid "Split chunk" msgstr "Podziel część" @@ -262,13 +278,13 @@ msgstr "Wstaw pustą część po" msgid "Add chunk" msgstr "Dodaj część" -#: templates/catalogue/chunk_edit.html:6 +#: templates/catalogue/chunk_edit.html:5 #: templates/catalogue/book_list/book.html:8 #: templates/catalogue/book_list/chunk.html:6 msgid "Chunk settings" msgstr "Ustawienia części" -#: templates/catalogue/chunk_edit.html:11 +#: templates/catalogue/chunk_edit.html:10 msgid "Book" msgstr "Książka" @@ -285,16 +301,20 @@ msgid "Bulk documents upload" msgstr "Hurtowe dodawanie dokumentów" #: templates/catalogue/document_upload.html:11 -msgid "Please submit a ZIP with UTF-8 encoded XML files. Files not ending with .xml will be ignored." -msgstr "Proszę wskazać archiwum ZIP z plikami XML w kodowaniu UTF-8. Pliki nie kończące się na .xml zostaną zignorowane." +msgid "" +"Please submit a ZIP with UTF-8 encoded XML files. Files not ending with " +".xml will be ignored." +msgstr "" +"Proszę wskazać archiwum ZIP z plikami XML w kodowaniu UTF-8. Pliki nie " +"kończące się na .xml zostaną zignorowane." -#: templates/catalogue/document_upload.html:17 -#: templatetags/catalogue.py:35 +#: templates/catalogue/document_upload.html:17 templatetags/catalogue.py:35 msgid "Upload" msgstr "Załaduj" #: templates/catalogue/document_upload.html:24 -msgid "There have been some errors. No files have been added to the repository." +msgid "" +"There have been some errors. No files have been added to the repository." msgstr "Wystąpiły błędy. Żadne pliki nie zostały dodane do repozytorium." #: templates/catalogue/document_upload.html:25 @@ -321,17 +341,15 @@ msgstr "Pominięte pliki" msgid "Files skipped due to no .xml extension" msgstr "Pliki pominięte z powodu braku rozszerzenia .xml." -#: templates/catalogue/my_page.html:13 +#: templates/catalogue/my_page.html:21 msgid "Your last edited documents" msgstr "Twoje ostatnie edycje" -#: templates/catalogue/my_page.html:22 -#: templates/catalogue/user_page.html:13 +#: templates/catalogue/my_page.html:30 templates/catalogue/user_page.html:13 msgid "Recent activity for" msgstr "Ostatnia aktywność dla:" -#: templates/catalogue/user_list.html:7 -#: templatetags/catalogue.py:31 +#: templates/catalogue/user_list.html:7 templatetags/catalogue.py:31 msgid "Users" msgstr "Użytkownicy" @@ -344,36 +362,37 @@ msgid "No activity recorded." msgstr "Nie zanotowano aktywności." #: templates/catalogue/book_list/book.html:7 -#: templates/catalogue/book_list/book.html:27 +#: templates/catalogue/book_list/book.html:28 msgid "Book settings" msgstr "Ustawienia książki" -#: templates/catalogue/book_list/book_list.html:21 +#: templates/catalogue/book_list/book_list.html:22 msgid "Show hidden books" msgstr "Pokaż ukryte książki" -#: templates/catalogue/book_list/book_list.html:26 +#: templates/catalogue/book_list/book_list.html:27 msgid "Search in book titles" msgstr "Szukaj w tytułach książek" -#: templates/catalogue/book_list/book_list.html:31 +#: templates/catalogue/book_list/book_list.html:32 msgid "stage" msgstr "etap" -#: templates/catalogue/book_list/book_list.html:33 -#: templates/catalogue/book_list/book_list.html:44 +#: templates/catalogue/book_list/book_list.html:34 +#: templates/catalogue/book_list/book_list.html:45 +#: templates/catalogue/book_list/book_list.html:64 msgid "none" msgstr "brak" -#: templates/catalogue/book_list/book_list.html:42 +#: templates/catalogue/book_list/book_list.html:43 msgid "editor" msgstr "redaktor" -#: templates/catalogue/book_list/book_list.html:53 +#: templates/catalogue/book_list/book_list.html:54 msgid "status" msgstr "status" -#: templates/catalogue/book_list/book_list.html:77 +#: templates/catalogue/book_list/book_list.html:88 #, python-format msgid "%(c)s book" msgid_plural "%(c)s books" @@ -381,27 +400,31 @@ msgstr[0] "%(c)s książka" msgstr[1] "%(c)s książki" msgstr[2] "%(c)s książek" -#: templates/catalogue/book_list/book_list.html:82 +#: templates/catalogue/book_list/book_list.html:93 msgid "No books found." msgstr "Nie znaleziono książek." -#: templates/catalogue/book_list/book_list.html:88 +#: templates/catalogue/book_list/book_list.html:99 msgid "Set stage" msgstr "Ustaw etap" -#: templates/catalogue/book_list/book_list.html:89 +#: templates/catalogue/book_list/book_list.html:100 msgid "Set user" msgstr "Przypisz redaktora" -#: templates/catalogue/book_list/book_list.html:91 +#: templates/catalogue/book_list/book_list.html:102 +msgid "Project" +msgstr "Projekt" + +#: templates/catalogue/book_list/book_list.html:103 msgid "Mark publishable" msgstr "Oznacz do publikacji" -#: templates/catalogue/book_list/book_list.html:92 +#: templates/catalogue/book_list/book_list.html:104 msgid "Mark not publishable" msgstr "Odznacz do publikacji" -#: templates/catalogue/book_list/book_list.html:93 +#: templates/catalogue/book_list/book_list.html:105 msgid "Other user" msgstr "Inny użytkownik" @@ -513,9 +536,6 @@ msgstr "Komentarz" #~ msgid "Describe the reason for reverting." #~ msgstr "Opisz powód przywrócenia." -#~ msgid "name" -#~ msgstr "nazwa" - #~ msgid "theme" #~ msgstr "motyw" @@ -630,9 +650,6 @@ msgstr "Komentarz" #~ msgid "Last edited by" #~ msgstr "Ostatnio edytowane przez" -#~ msgid "Link to gallery" -#~ msgstr "Link do galerii" - #~ msgid "Summary" #~ msgstr "Podsumowanie" diff --git a/apps/catalogue/migrations/0003_from_hg.py b/apps/catalogue/migrations/0003_from_hg.py index 1816af90..d8360676 100644 --- a/apps/catalogue/migrations/0003_from_hg.py +++ b/apps/catalogue/migrations/0003_from_hg.py @@ -7,7 +7,6 @@ import re import urllib from django.db import models -from mercurial import hg, ui from south.db import db from south.v2 import DataMigration @@ -160,6 +159,8 @@ class Migration(DataMigration): except: print 'repository not configured, skipping' else: + from mercurial import hg, ui + print 'migrate from', hg_path repo = hg.repository(ui.ui(), hg_path) tip = repo['tip'] diff --git a/apps/catalogue/migrations/0011_auto__add_project__add_field_book_project.py b/apps/catalogue/migrations/0011_auto__add_project__add_field_book_project.py new file mode 100644 index 00000000..6f30cb4f --- /dev/null +++ b/apps/catalogue/migrations/0011_auto__add_project__add_field_book_project.py @@ -0,0 +1,159 @@ +# -*- 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 'Project' + db.create_table(u'catalogue_project', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=255)), + ('notes', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + )) + db.send_create_signal('catalogue', ['Project']) + + # Adding field 'Book.project' + db.add_column(u'catalogue_book', 'project', + self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Project'], null=True), + keep_default=False) + + + def backwards(self, orm): + # Deleting model 'Project' + db.delete_table(u'catalogue_project') + + # Deleting field 'Book.project' + db.delete_column(u'catalogue_book', 'project_id') + + + models = { + u'auth.group': { + 'Meta': {'object_name': 'Group'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + u'auth.permission': { + 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + u'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'catalogue.book': { + 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'}, + '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}), + 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), + 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True'}), + 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}) + }, + 'catalogue.bookpublishrecord': { + 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'}, + 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"}) + }, + 'catalogue.chunk': { + 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'}, + '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}), + '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), + 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}), + 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': u"orm['auth.User']"}), + 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}), + 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'number': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), + 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.chunkchange': { + 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'}, + 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}), + 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), + 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}), + 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}), + 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}), + 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}), + 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}), + 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"}) + }, + 'catalogue.chunkpublishrecord': { + 'Meta': {'object_name': 'ChunkPublishRecord'}, + 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}), + 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + 'catalogue.chunktag': { + 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}), + 'ordering': ('django.db.models.fields.IntegerField', [], {}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) + }, + 'catalogue.project': { + 'Meta': {'ordering': "['name']", 'object_name': 'Project'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}), + 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}) + }, + u'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + u'cover.image': { + 'Meta': {'object_name': 'Image'}, + 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'download_url': ('django.db.models.fields.URLField', [], {'unique': 'True', 'max_length': '200'}), + 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}), + 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}), + 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) + } + } + + complete_apps = ['catalogue'] \ No newline at end of file diff --git a/apps/catalogue/models/__init__.py b/apps/catalogue/models/__init__.py index 6161807b..bd069f1c 100755 --- a/apps/catalogue/models/__init__.py +++ b/apps/catalogue/models/__init__.py @@ -3,6 +3,7 @@ # This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from catalogue.models.project import Project from catalogue.models.chunk import Chunk from catalogue.models.publish_log import BookPublishRecord, ChunkPublishRecord from catalogue.models.book import Book diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index 4d1b12e4..b1b2730f 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -13,7 +13,7 @@ from slughifi import slughifi import apiclient from catalogue.helpers import cached_in_field, GalleryMerger -from catalogue.models import BookPublishRecord, ChunkPublishRecord +from catalogue.models import BookPublishRecord, ChunkPublishRecord, Project from catalogue.signals import post_publish from catalogue.tasks import refresh_instance, book_content_updated from catalogue.xml_tools import compile_text, split_xml @@ -29,6 +29,7 @@ class Book(models.Model): slug = models.SlugField(_('slug'), max_length=128, unique=True, db_index=True) public = models.BooleanField(_('public'), default=True, db_index=True) gallery = models.CharField(_('scan gallery name'), max_length=255, blank=True) + project = models.ForeignKey(Project, null=True) #wl_slug = models.CharField(_('title'), max_length=255, null=True, db_index=True, editable=False) parent = models.ForeignKey('self', null=True, blank=True, verbose_name=_('parent'), related_name="children", editable=False) diff --git a/apps/catalogue/models/project.py b/apps/catalogue/models/project.py new file mode 100755 index 00000000..eb951021 --- /dev/null +++ b/apps/catalogue/models/project.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# +# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +from django.db import models +from django.utils.translation import ugettext_lazy as _ + + +class Project(models.Model): + """ A project, tracked for funding purposes. """ + + name = models.CharField(_('name'), max_length=255, unique=True) + notes = models.TextField(_('notes'), blank=True, null=True) + + class Meta: + app_label = 'catalogue' + ordering = ['name'] + verbose_name = _('project') + verbose_name_plural = _('projects') + + def __unicode__(self): + return self.name diff --git a/apps/catalogue/templates/catalogue/activity.html b/apps/catalogue/templates/catalogue/activity.html index 9c2eac51..c88b5388 100755 --- a/apps/catalogue/templates/catalogue/activity.html +++ b/apps/catalogue/templates/catalogue/activity.html @@ -1,6 +1,5 @@ {% extends "catalogue/base.html" %} {% load i18n %} -{% load url from future %} {% load wall %} diff --git a/apps/catalogue/templates/catalogue/base.html b/apps/catalogue/templates/catalogue/base.html index 949b5f29..d2af462b 100644 --- a/apps/catalogue/templates/catalogue/base.html +++ b/apps/catalogue/templates/catalogue/base.html @@ -12,7 +12,7 @@
- + diff --git a/apps/catalogue/templates/catalogue/book_detail.html b/apps/catalogue/templates/catalogue/book_detail.html index 7f3497b6..eea6a6c7 100755 --- a/apps/catalogue/templates/catalogue/book_detail.html +++ b/apps/catalogue/templates/catalogue/book_detail.html @@ -16,9 +16,12 @@ {% if editable %}{% endif %} - {% if editable %} -

{% trans "Append to other book" %}

+ {% if book.gallery %} +

{% trans "Edit gallery" %}

+ {% endif %} + +

{% trans "Append to other book" %}

{% endif %} @@ -42,7 +45,7 @@

{% trans "Publication" %}

- + {% if book.dc_cover_image %} {{ book.dc_cover_image }} {% endif %} @@ -58,11 +61,11 @@ {% if publishable %}

- {% trans "Full XML" %}
- {% trans "HTML version" %}
- {% trans "TXT version" %}
- {% trans "PDF version" %}
- {% trans "EPUB version" %}
+ {% trans "Full XML" %}
+ {% trans "HTML version" %}
+ {% trans "TXT version" %}
+ {% trans "PDF version" %}
+ {% trans "EPUB version" %}

{% if user.is_authenticated %} @@ -72,14 +75,14 @@ mira66 (http://www.flickr.com/photos/21804434@N02/) / CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/) --> -
{% csrf_token %} + {% csrf_token %}
{% else %} - {% trans "Log in to publish." %} + {% trans "Log in to publish." %} {% endif %} {% else %}

{% trans "This book can't be published yet, because:" %}

diff --git a/apps/catalogue/templates/catalogue/book_list/book.html b/apps/catalogue/templates/catalogue/book_list/book.html index 1e025e39..5866e6ac 100755 --- a/apps/catalogue/templates/catalogue/book_list/book.html +++ b/apps/catalogue/templates/catalogue/book_list/book.html @@ -4,27 +4,28 @@ {% with book.0 as chunk %} - [B] - [c] + [B] + [c] + href="{% url 'wiki_editor' book.slug %}"> {{ book.title }} {% if chunk.stage %} {{ chunk.stage }} {% else %}– {% endif %} - {% if chunk.user %}{{ chunk.user.first_name }} {{ chunk.user.last_name }}{% endif %} + {% if chunk.user %}{{ chunk.user.first_name }} {{ chunk.user.last_name }}{% endif %} {% if chunk.published %}P{% endif %} {% if book.new_publishable %}p{% endif %} {% if chunk.changed %}+{% endif %} + {{ book.project.name }} {% endwith %} {% else %} - [B] + [B] {{ book.title }} @@ -33,5 +34,6 @@ {% if book.published %}P{% endif %} {% if book.new_publishable %}p{% endif %} + {{ book.project.name }} {% endif %} diff --git a/apps/catalogue/templates/catalogue/book_list/book_list.html b/apps/catalogue/templates/catalogue/book_list/book_list.html index c2f5e7c8..90ae183f 100755 --- a/apps/catalogue/templates/catalogue/book_list/book_list.html +++ b/apps/catalogue/templates/catalogue/book_list/book_list.html @@ -10,6 +10,7 @@ {% endif %} + @@ -57,6 +58,16 @@ {% endfor %} + + {% with cnt=books|length %} @@ -82,12 +93,13 @@

{% trans "No books found." %}

{% endif %} -