From: Radek Czajka Date: Tue, 9 Jul 2013 08:16:41 +0000 (+0200) Subject: #2466: Assign books to projects. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/f155d09d81873bcb831186335a94c5a76843a33d #2466: Assign books to projects. --- diff --git a/apps/catalogue/admin.py b/apps/catalogue/admin.py index c888a086..7fbacad9 100644 --- a/apps/catalogue/admin.py +++ b/apps/catalogue/admin.py @@ -3,12 +3,13 @@ from django.contrib import admin from catalogue import models class BookAdmin(admin.ModelAdmin): - list_display = ['title', 'public', '_published', '_new_publishable'] - list_filter = ['public', '_published', '_new_publishable'] + 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 743dc5e6..fa4fb650 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 b3d1b8ec..97006191 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: 2013-03-07 16:25+0100\n" -"PO-Revision-Date: 2013-03-07 16:26+0100\n" +"POT-Creation-Date: 2013-07-09 10:15+0200\n" +"PO-Revision-Date: 2013-07-09 10:15+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,22 +61,19 @@ msgstr "Dokument o tym slugu już istnieje w repozytorium." msgid "File should be UTF-8 encoded." msgstr "Plik powinien mieć kodowanie UTF-8." -#: views.py:484 -#: models/book.py:55 +#: views.py:487 models/book.py:56 msgid "books" msgstr "książki" -#: views.py:486 +#: views.py:489 msgid "scan gallery" msgstr "galeria skanów" -#: models/book.py:28 -#: models/chunk.py:23 +#: models/book.py:28 models/chunk.py:23 msgid "title" msgstr "tytuł" -#: models/book.py:29 -#: models/chunk.py:24 +#: models/book.py:29 models/chunk.py:24 msgid "slug" msgstr "slug" @@ -86,41 +85,39 @@ msgstr "publiczna" msgid "scan gallery name" msgstr "nazwa galerii skanów" -#: models/book.py:34 +#: models/book.py:35 msgid "parent" msgstr "rodzic" -#: models/book.py:35 +#: models/book.py:36 msgid "parent number" msgstr "numeracja rodzica" -#: models/book.py:54 -#: 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:254 +#: models/book.py:255 msgid "No chunks in the book." msgstr "Książka nie ma części." -#: models/book.py:258 +#: models/book.py:259 msgid "Not all chunks have publishable revisions." msgstr "Niektóre części nie są gotowe do publikacji." -#: models/book.py:265 +#: models/book.py:266 msgid "Invalid XML" msgstr "Nieprawidłowy XML" -#: models/book.py:267 +#: models/book.py:268 msgid "No Dublin Core found." msgstr "Brak sekcji Dublin Core." -#: models/book.py:269 +#: models/book.py:270 msgid "Invalid Dublin Core" msgstr "Nieprawidłowy Dublin Core" -#: models/book.py:272 +#: models/book.py:273 msgid "rdf:about is not" msgstr "rdf:about jest różny od" @@ -140,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 +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" @@ -170,8 +181,7 @@ msgstr "zapis publikacji części" msgid "chunk publish records" msgstr "zapisy publikacji części" -#: templates/catalogue/activity.html:9 -#: templatetags/catalogue.py:29 +#: templates/catalogue/activity.html:9 templatetags/catalogue.py:29 msgid "Activity" msgstr "Aktywność" @@ -184,65 +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:12 +#: templates/catalogue/book_edit.html:9 templates/catalogue/chunk_edit.html:12 msgid "Save" msgstr "Zapisz" -#: templates/catalogue/book_detail.html:20 +#: templates/catalogue/book_detail.html:21 msgid "Edit gallery" msgstr "Edytuj galerię" -#: templates/catalogue/book_detail.html:22 +#: templates/catalogue/book_detail.html:24 msgid "Append to other book" msgstr "Dołącz do innej książki" -#: templates/catalogue/book_detail.html:28 +#: templates/catalogue/book_detail.html:30 msgid "Chunks" msgstr "Części" -#: templates/catalogue/book_detail.html:43 -#: templatetags/wall.py:78 +#: templates/catalogue/book_detail.html:45 templatetags/wall.py:78 msgid "Publication" msgstr "Publikacja" -#: templates/catalogue/book_detail.html:52 +#: templates/catalogue/book_detail.html:54 msgid "Last published" msgstr "Ostatnio opublikowano" -#: templates/catalogue/book_detail.html:62 +#: templates/catalogue/book_detail.html:64 msgid "Full XML" msgstr "Pełny XML" -#: templates/catalogue/book_detail.html:63 +#: templates/catalogue/book_detail.html:65 msgid "HTML version" msgstr "Wersja HTML" -#: templates/catalogue/book_detail.html:64 +#: templates/catalogue/book_detail.html:66 msgid "TXT version" msgstr "Wersja TXT" -#: templates/catalogue/book_detail.html:65 +#: templates/catalogue/book_detail.html:67 msgid "PDF version" msgstr "Wersja PDF" -#: templates/catalogue/book_detail.html:66 +#: templates/catalogue/book_detail.html:68 msgid "EPUB version" msgstr "Wersja EPUB" -#: templates/catalogue/book_detail.html:79 +#: templates/catalogue/book_detail.html:81 msgid "Publish" msgstr "Opublikuj" -#: templates/catalogue/book_detail.html:83 +#: templates/catalogue/book_detail.html:85 msgid "Log in to publish." msgstr "Zaloguj się, aby opublikować." -#: templates/catalogue/book_detail.html:86 +#: 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:96 +#: templates/catalogue/book_detail.html:98 msgid "Comments" msgstr "Komentarze" @@ -258,8 +266,7 @@ msgstr "Spis treści" msgid "Edit. note" msgstr "Nota red." -#: templates/catalogue/chunk_add.html:5 -#: templates/catalogue/chunk_edit.html:18 +#: templates/catalogue/chunk_add.html:5 templates/catalogue/chunk_edit.html:18 msgid "Split chunk" msgstr "Podziel część" @@ -294,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 @@ -334,13 +345,11 @@ msgstr "Pliki pominięte z powodu braku rozszerzenia .xml." msgid "Your last edited documents" msgstr "Twoje ostatnie edycje" -#: templates/catalogue/my_page.html:30 -#: 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" @@ -522,9 +531,6 @@ msgstr "Komentarz" #~ msgid "Describe the reason for reverting." #~ msgstr "Opisz powód przywrócenia." -#~ msgid "name" -#~ msgstr "nazwa" - #~ msgid "theme" #~ msgstr "motyw" 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