From: Jan Szejko Date: Mon, 7 Mar 2016 14:04:45 +0000 (+0100) Subject: local changes from server X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/2f9cb34a07fcd98effda2fa900e48c31813f14c8?hp=82c38a77943cf91a084429bf10740edffbd0c195 local changes from server --- diff --git a/.gitignore b/.gitignore index 920f51fa..a9dc4e6e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,12 @@ localsettings.py -dev.sqlite +*.sqlite requirements.pybundle *~ *.orig /redakcja/media /static .sass-cache +var # Python garbage *.pyc diff --git a/README.md b/README.md index 93ffb1c4..23e69d71 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,15 @@ Instalacja i użycie pip install -r requirements.txt -#. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika):: +#. Skopiuj zawartość pliku `project/localsettings.sample` do `project/localsettings.py` i zmień go zgodnie ze swoimi potrzebami. - ./project/manage.py syncdb +#. Pobierz edytor:: -#. Skopiuj zawartość pliku `project/localsettings.sample` do `project/localsettings.py` i zmień go zgodnie ze swoimi potrzebami. + git submodule update --init + +#. Wypełnij bazę danych (Django poprosi o utworzenie pierwszego użytkownika):: + + ./project/manage.py syncdb --migrate #. Uruchom serwer deweloperski:: @@ -48,4 +52,4 @@ 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/catalogue/admin.py b/apps/catalogue/admin.py index f8cda9fe..93298174 100644 --- a/apps/catalogue/admin.py +++ b/apps/catalogue/admin.py @@ -2,16 +2,5 @@ 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) +admin.site.register(models.Document) admin.site.register(models.Template) - -admin.site.register(models.Chunk.tag_model) diff --git a/apps/catalogue/constants.py b/apps/catalogue/constants.py index 0c842324..dbdb5748 100644 --- a/apps/catalogue/constants.py +++ b/apps/catalogue/constants.py @@ -14,3 +14,11 @@ MASTERS = ['powiesc', 'dramat_wierszowany_lp', 'dramat_wspolczesny', ] + +STAGES = [ + 'Draft', + 'Comments', + 'Comments review', + 'Proofreading', + 'Publication', + ] \ No newline at end of file diff --git a/apps/catalogue/ebook_utils.py b/apps/catalogue/ebook_utils.py index d9c99227..56b73402 100644 --- a/apps/catalogue/ebook_utils.py +++ b/apps/catalogue/ebook_utils.py @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- from StringIO import StringIO -from catalogue.models import Book -from librarian import DocProvider +#from catalogue.models import Book +#from librarian import DocProvider from django.http import HttpResponse -class RedakcjaDocProvider(DocProvider): - """Used for getting books' children.""" - - def __init__(self, publishable): - self.publishable = publishable - - def by_slug(self, slug): - return StringIO(Book.objects.get(dc_slug=slug - ).materialize(publishable=self.publishable - ).encode('utf-8')) +#~ class RedakcjaDocProvider(DocProvider): + #~ """Used for getting books' children.""" +#~ + #~ def __init__(self, publishable): + #~ self.publishable = publishable +#~ + #~ def by_slug(self, slug): + #~ return StringIO(Book.objects.get(dc_slug=slug + #~ ).materialize(publishable=self.publishable + #~ ).encode('utf-8')) def serve_file(file_path, name, mime_type): @@ -24,7 +24,7 @@ def serve_file(file_path, name, mime_type): yield chunk chunk = f.read(size) - response = HttpResponse(mimetype=mime_type) + response = HttpResponse(content_type=mime_type) response['Content-Disposition'] = 'attachment; filename=%s' % name with open(file_path) as f: for chunk in read_chunks(f): diff --git a/apps/catalogue/feeds.py b/apps/catalogue/feeds.py deleted file mode 100644 index 4884a4cd..00000000 --- a/apps/catalogue/feeds.py +++ /dev/null @@ -1,29 +0,0 @@ -# -*- coding: utf-8 -*- -from django.contrib.syndication.views import Feed -from django.shortcuts import get_object_or_404 -from catalogue.models import Book, Chunk - -class PublishTrackFeed(Feed): - title = u"Planowane publikacje" - link = "/" - - def description(self, obj): - tag, published = obj - return u"Publikacje, które dotarły co najmniej do etapu: %s" % tag.name - - def get_object(self, request, slug): - published = request.GET.get('published') - if published is not None: - published = published == 'true' - return get_object_or_404(Chunk.tag_model, slug=slug), published - - def item_title(self, item): - return item.title - - def items(self, obj): - tag, published = obj - books = Book.objects.filter(public=True, _on_track__gte=tag.ordering - ).order_by('-_on_track', 'title') - if published is not None: - books = books.filter(_published=published) - return books diff --git a/apps/catalogue/fixtures/stages.json b/apps/catalogue/fixtures/stages.json deleted file mode 100644 index 5a46ec04..00000000 --- a/apps/catalogue/fixtures/stages.json +++ /dev/null @@ -1,83 +0,0 @@ -[ - { - "pk": 1, - "model": "catalogue.chunktag", - "fields": { - "ordering": 1, - "name": "Autokorekta", - "slug": "first_correction" - } - }, - { - "pk": 2, - "model": "catalogue.chunktag", - "fields": { - "ordering": 2, - "name": "Tagowanie", - "slug": "tagging" - } - }, - { - "pk": 3, - "model": "catalogue.chunktag", - "fields": { - "ordering": 3, - "name": "Korekta", - "slug": "proofreading" - } - }, - { - "pk": 4, - "model": "catalogue.chunktag", - "fields": { - "ordering": 4, - "name": "Sprawdzenie przypis\u00f3w \u017ar\u00f3d\u0142a", - "slug": "annotation-proofreading" - } - }, - { - "pk": 5, - "model": "catalogue.chunktag", - "fields": { - "ordering": 5, - "name": "Uwsp\u00f3\u0142cze\u015bnienie", - "slug": "modernisation" - } - }, - { - "pk": 6, - "model": "catalogue.chunktag", - "fields": { - "ordering": 6, - "name": "Przypisy", - "slug": "annotations" - } - }, - { - "pk": 7, - "model": "catalogue.chunktag", - "fields": { - "ordering": 7, - "name": "Motywy", - "slug": "themes" - } - }, - { - "pk": 8, - "model": "catalogue.chunktag", - "fields": { - "ordering": 8, - "name": "Ostateczna redakcja literacka", - "slug": "editor-proofreading" - } - }, - { - "pk": 9, - "model": "catalogue.chunktag", - "fields": { - "ordering": 9, - "name": "Ostateczna redakcja techniczna", - "slug": "technical-editor-proofreading" - } - } -] diff --git a/apps/catalogue/forms.py b/apps/catalogue/forms.py index 85f92efc..4b1214f4 100644 --- a/apps/catalogue/forms.py +++ b/apps/catalogue/forms.py @@ -9,36 +9,47 @@ from django import forms from django.utils.translation import ugettext_lazy as _ from catalogue.constants import MASTERS -from catalogue.models import Book, Chunk, Template +from catalogue.models import Document, Template -class DocumentCreateForm(forms.ModelForm): +class DocumentCreateForm(forms.Form): """ Form used for creating new documents. """ - template = forms.ModelChoiceField(Template.objects, required=False) - - class Meta: - model = Book - exclude = ['parent', 'parent_number', 'project', 'gallery', 'public'] - - def __init__(self, *args, **kwargs): - super(DocumentCreateForm, self).__init__(*args, **kwargs) - self.fields['slug'].widget.attrs={'class': 'autoslug'} - self.fields['title'].widget.attrs={'class': 'autoslug-source'} - self.fields['template'].queryset = Template.objects.filter(is_main=True) - - def clean(self): - super(DocumentCreateForm, self).clean() - template = self.cleaned_data['template'] - self.cleaned_data['gallery'] = self.cleaned_data['slug'] - - if template is not None: - self.cleaned_data['text'] = template.content - - if not self.cleaned_data.get("text"): - self._errors["template"] = self.error_class([_("You must select a template")]) - - return self.cleaned_data + owner_organization = forms.CharField(required=False) + title = forms.CharField(required=True) + language = forms.CharField(required=True) + publisher = forms.CharField(required=False) + description = forms.CharField(required=False) + rights = forms.CharField(required=False) + audience = forms.CharField() + + cover = forms.FileField(required=False) + + #summary = forms.CharField(required=True) + #template = forms.ModelChoiceField(Template.objects, required=False) + + #class Meta: + #model = Book + #exclude = ['parent', 'parent_number', 'project', 'gallery', 'public'] + + #def __init__(self, *args, org=None, **kwargs): + # super(DocumentCreateForm, self).__init__(*args, **kwargs) + #self.fields['slug'].widget.attrs={'class': 'autoslug'} + #self.fields['title'].widget.attrs={'class': 'autoslug-source'} + #self.fields['template'].queryset = Template.objects.filter(is_main=True) + + #~ def clean(self): + #~ super(DocumentCreateForm, self).clean() + #template = self.cleaned_data['template'] + #self.cleaned_data['gallery'] = self.cleaned_data['slug'] + + #~ if template is not None: + #~ self.cleaned_data['text'] = template.content + + #~ if not self.cleaned_data.get("text"): + #~ self._errors["template"] = self.error_class([_("You must select a template")]) + + #~ return self.cleaned_data class DocumentsUploadForm(forms.Form): @@ -63,38 +74,20 @@ class DocumentsUploadForm(forms.Form): return self.cleaned_data -class ChunkForm(forms.ModelForm): +class DocumentForm(forms.ModelForm): """ Form used for editing a chunk. """ user = forms.ModelChoiceField(queryset= - User.objects.annotate(count=Count('chunk')). - order_by('last_name', 'first_name'), required=False, + User.objects.order_by('last_name', 'first_name'), required=False, label=_('Assigned to')) class Meta: - model = Chunk - fields = ['title', 'slug', 'gallery_start', 'user', 'stage'] - exclude = ['number'] - - def __init__(self, *args, **kwargs): - super(ChunkForm, self).__init__(*args, **kwargs) - self.fields['gallery_start'].widget.attrs={'class': 'number-input'} - self.fields['slug'].widget.attrs={'class': 'autoslug'} - self.fields['title'].widget.attrs={'class': 'autoslug-source'} - - def clean_slug(self): - slug = self.cleaned_data['slug'] - try: - chunk = Chunk.objects.get(book=self.instance.book, slug=slug) - except Chunk.DoesNotExist: - return slug - if chunk == self.instance: - return slug - raise forms.ValidationError(_('Chunk with this slug already exists')) + model = Document + fields = ['user', 'stage'] -class ChunkAddForm(ChunkForm): +class DocumentAddForm(DocumentForm): """ Form used for adding a chunk to a document. """ @@ -108,25 +101,11 @@ class ChunkAddForm(ChunkForm): raise forms.ValidationError(_('Chunk with this slug already exists')) -class BookAppendForm(forms.Form): - """ - Form for appending a book to another book. - It means moving all chunks from book A to book B and deleting A. - """ - append_to = forms.ModelChoiceField(queryset=Book.objects.all(), - label=_("Append to")) - - def __init__(self, book, *args, **kwargs): - ret = super(BookAppendForm, self).__init__(*args, **kwargs) - self.fields['append_to'].queryset = Book.objects.exclude(pk=book.pk) - return ret - - class BookForm(forms.ModelForm): """Form used for editing a Book.""" class Meta: - model = Book + model = Document exclude = ['project'] def __init__(self, *args, **kwargs): @@ -152,3 +131,10 @@ class ChooseMasterForm(forms.Form): """ master = forms.ChoiceField(choices=((m, m) for m in MASTERS)) + + +class DocumentForkForm(forms.Form): + """ + Form used for forking documents. + """ + owner_organization = forms.CharField(required=False) diff --git a/apps/catalogue/helpers.py b/apps/catalogue/helpers.py index d340b461..7e4ce526 100644 --- a/apps/catalogue/helpers.py +++ b/apps/catalogue/helpers.py @@ -87,7 +87,6 @@ class GalleryMerger(object): self.src_size = len(files_other) if files and files_other: - print "compare %s with %s" % (files[-1], files_other[0]) if filecmp.cmp( join(self.path(self.dest), files[-1]), join(self.path(self.src), files_other[0]), @@ -146,3 +145,13 @@ class GalleryMerger(object): rmtree(join(self.path(self.src))) return self.dest + + +# Maybe subclass? +def sstdocument(text): + #from catalogue.ebook_utils import RedakcjaDocProvider + from librarian.document import Document + + return Document.from_string( + text, + ) diff --git a/apps/catalogue/locale/pl/LC_MESSAGES/django.mo b/apps/catalogue/locale/pl/LC_MESSAGES/django.mo index 0187fa86..4149f307 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 5f5148e3..d1a798c4 100644 --- a/apps/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/apps/catalogue/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Platforma Redakcyjna\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-01 11:28+0200\n" +"POT-Creation-Date: 2016-01-26 12:15+0100\n" "PO-Revision-Date: 2014-04-01 11:29+0100\n" "Last-Translator: Radek Czajka \n" "Language-Team: Fundacja Nowoczesna Polska =20) ? 1 : 2);\n" "X-Generator: Poedit 1.5.4\n" -#: forms.py:38 -msgid "You must select a template" -msgstr "Musisz wybrać szablon" - -#: forms.py:47 +#: forms.py:59 msgid "ZIP file" msgstr "Plik ZIP" -#: forms.py:48 +#: forms.py:60 msgid "Directories are documents in chunks" msgstr "Katalogi zawierają dokumenty w częściach" -#: forms.py:72 +#: forms.py:83 templates/catalogue/book_list/book_list.html:11 msgid "Assigned to" msgstr "Przypisane do" -#: forms.py:93 forms.py:107 +#: forms.py:101 msgid "Chunk with this slug already exists" msgstr "Część z tym slugiem już istnieje" -#: forms.py:116 -msgid "Append to" -msgstr "Dołącz do" - -#: views.py:161 -#, python-format -msgid "Slug already used for %s" -msgstr "Slug taki sam jak dla pliku %s" - -#: views.py:163 -msgid "Slug already used in repository." -msgstr "Dokument o tym slugu już istnieje w repozytorium." - -#: views.py:169 -msgid "File should be UTF-8 encoded." -msgstr "Plik powinien mieć kodowanie UTF-8." - -#: models/book.py:28 models/chunk.py:23 +#: models/book.py:30 msgid "title" msgstr "tytuł" -#: models/book.py:29 models/chunk.py:24 +#: models/book.py:31 msgid "slug" msgstr "slug" -#: models/book.py:30 +#: models/book.py:32 msgid "public" msgstr "publiczna" -#: models/book.py:35 +#: models/book.py:40 msgid "parent" msgstr "rodzic" -#: models/book.py:36 +#: models/book.py:41 msgid "parent number" msgstr "numeracja rodzica" -#: models/book.py:55 models/chunk.py:21 models/publish_log.py:17 -msgid "book" -msgstr "książka" - -#: models/book.py:56 -msgid "books" -msgstr "książki" - -#: models/book.py:255 +#: models/book.py:260 msgid "No chunks in the book." msgstr "Książka nie ma części." -#: models/book.py:259 +#: models/book.py:264 msgid "Not all chunks have publishable revisions." msgstr "Niektóre części nie są gotowe do publikacji." -#: models/book.py:266 +#: models/book.py:271 msgid "Invalid XML" msgstr "Nieprawidłowy XML" -#: models/book.py:268 +#: models/book.py:273 msgid "No Dublin Core found." msgstr "Brak sekcji Dublin Core." -#: models/book.py:270 +#: models/book.py:275 msgid "Invalid Dublin Core" msgstr "Nieprawidłowy Dublin Core" -#: models/book.py:273 +#: models/book.py:278 msgid "rdf:about is not" msgstr "rdf:about jest różny od" -#: models/chunk.py:22 -msgid "number" -msgstr "numer" - -#: models/chunk.py:25 -msgid "gallery start" -msgstr "początek galerii" - -#: models/chunk.py:40 -msgid "chunk" -msgstr "część" +#: models/document.py:23 +msgid "stage" +msgstr "etap" -#: models/chunk.py:41 -msgid "chunks" -msgstr "części" +#: models/document.py:31 models/publish_log.py:15 +msgid "document" +msgstr "dokument" -#: models/project.py:13 -msgid "name" -msgstr "nazwa" +#: models/document.py:32 +msgid "documents" +msgstr "dokumenty" -#: models/project.py:14 -msgid "notes" -msgstr "notatki" +#: models/publish_log.py:16 +msgid "revision" +msgstr "rewizja" -#: models/publish_log.py:18 +#: models/publish_log.py:17 msgid "time" msgstr "czas" -#: models/publish_log.py:19 templates/catalogue/wall.html:18 +#: models/publish_log.py:18 templates/catalogue/wall.html:18 msgid "user" msgstr "użytkownik" -#: models/publish_log.py:24 models/publish_log.py:33 +#: models/publish_log.py:22 msgid "book publish record" msgstr "zapis publikacji książki" -#: models/publish_log.py:25 +#: models/publish_log.py:23 msgid "book publish records" msgstr "zapisy publikacji książek" -#: models/publish_log.py:34 -msgid "change" -msgstr "zmiana" - -#: models/publish_log.py:38 -msgid "chunk publish record" -msgstr "zapis publikacji części" - -#: models/publish_log.py:39 -msgid "chunk publish records" -msgstr "zapisy publikacji części" - -#: templates/catalogue/activity.html:9 templatetags/catalogue.py:29 +#: templates/catalogue/activity.html:9 msgid "Activity" msgstr "Aktywność" -#: templates/catalogue/base.html:8 -msgid "Platforma Redakcyjna" -msgstr "Platforma Redakcyjna" - #: templates/catalogue/book_append_to.html:9 msgid "Append book" msgstr "Dołącz książkę" -#: templates/catalogue/book_detail.html:14 +#: templates/catalogue/book_delete.html:5 +#: templates/catalogue/book_owner.html:5 +#: templates/catalogue/book_schedule.html:10 +#: templates/catalogue/my_page.html:12 +msgid "My resources" +msgstr "Moje zasoby" + +#: templates/catalogue/book_delete.html:13 +msgid "Really delete the resource?" +msgstr "Naprawdę usunąć zasób" + +#: templates/catalogue/book_delete.html:17 +#: templates/catalogue/book_list/book.html:23 +#: templates/catalogue/book_text.html:49 +msgid "Delete" +msgstr "Usun" + +#: templates/catalogue/book_delete.html:18 +msgid "Cancel" +msgstr "Anuluj" + +#: templates/catalogue/book_detail.html:13 +#: templates/catalogue/book_list/book.html:22 +msgid "Schedule" +msgstr "Plan" + #: 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_list/book.html:12 +msgid "change" +msgstr "zmiana" + +#: templates/catalogue/book_list/book.html:21 +#: templates/catalogue/book_schedule.html:7 templatetags/wall.py:51 +msgid "Edit" +msgstr "Zmień" + +#: templates/catalogue/book_list/book_list.html:8 +#: templates/catalogue/document_create_missing.html:24 +msgid "Title" +msgstr "Tytuł" + +#: templates/catalogue/book_list/book_list.html:9 +#: templates/catalogue/book_owner.html:16 +#: templates/catalogue/document_create_missing.html:11 +#: templates/catalogue/finished.html:26 templates/catalogue/upcoming.html:26 +msgid "Owner" +msgstr "Właściciel" + +#: templates/catalogue/book_list/book_list.html:10 +#: templates/catalogue/book_schedule.html:28 +msgid "Stage" +msgstr "Etap" + +#: templates/catalogue/book_list/book_list.html:12 +#: templates/catalogue/book_schedule.html:30 +msgid "Deadline" +msgstr "Termin" + +#: templates/catalogue/book_list/book_list.html:25 +msgid "No resources found." +msgstr "Nie znaleziono zasobów." -#: templates/catalogue/book_detail.html:24 -msgid "Append to other book" -msgstr "Dołącz do innej książki" +#: templates/catalogue/book_list/chunk.html:6 +#: templates/catalogue/chunk_edit.html:5 +msgid "Chunk settings" +msgstr "Ustawienia części" -#: templates/catalogue/book_detail.html:30 -msgid "Chunks" -msgstr "Części" +#: templates/catalogue/book_owner.html:26 +#: templates/catalogue/book_text.html:48 +msgid "Change owner" +msgstr "Zmień właściciela" -#: templates/catalogue/book_detail.html:45 templatetags/wall.py:78 -msgid "Publication" -msgstr "Publikacja" +#: templates/catalogue/book_schedule.html:8 +#: templates/catalogue/book_text.html:47 templates/catalogue/book_text.html:55 +#: templates/catalogue/document_fork.html:20 +msgid "Create another version" +msgstr "Utwórz odrębną wersję" + +#: templates/catalogue/book_schedule.html:29 +msgid "Person" +msgstr "Osoba" + +#: templates/catalogue/book_schedule.html:57 +msgid "Current stage" +msgstr "Aktualny etap" + +#: templates/catalogue/book_schedule.html:72 +msgid "Update" +msgstr "Zaktualizuj" + +#: templates/catalogue/book_text.html:23 templates/catalogue/book_text.html:30 +msgid "Resource owner" +msgstr "Właściciel zasobu" + +#: templates/catalogue/book_text.html:38 +msgid "You can edit your resource here." +msgstr "Tutaj możesz edytować zasób" -#: templates/catalogue/book_detail.html:54 -msgid "Last published" -msgstr "Ostatnio opublikowano" +#: templates/catalogue/book_text.html:42 +msgid "You can assign work stages and deadlines to people on your team." +msgstr "Możesz przypisywać etapy prac i terminy osobom w Twoim zespole." -#: templates/catalogue/book_detail.html:64 -msgid "Full XML" -msgstr "Pełny XML" +#: templates/catalogue/book_text.html:46 +msgid "" +"You can also create another, independent version of this resource – e.g. for " +"translation to other language or simply for adapting it to your needs." +msgstr "" +"Możesz też utworzyć osobną, niezależną wersję tego zasobu – np. w celu " +"tłumaczenia na inny język albo po prostu aby dostosować go do swoich potrzeb." + +#: templates/catalogue/book_text.html:54 +msgid "" +"You can create and edit another, independent version of this resource – e.g. " +"for translation to other language or simply for adapting it to your needs." +msgstr "" +"Możesz utworzyć osobną, niezależną wersję tego zasobu – np. w celu " +"tłumaczenia na inny język albo po prostu aby dostosować go do swoich potrzeb." + + +#: templates/catalogue/book_text.html:69 +#, python-format +msgid "" +"This is a preview of a specific revision of this " +"resource." +msgstr "" +"To jest podgląd konkretnej rewizji tego zasobu." + +#: templates/catalogue/book_text.html:74 +#, python-format +msgid "" +"There have been some changes since this revision. See " +"the current revision." +msgstr "" +"W dokumencie są zmiany nowsze od aktualnie oglądanej rewizji. Zobacz aktualną rewizję." + +#: templates/catalogue/book_text.html:80 +#, python-format +msgid "This resource has a published version." +msgstr "Ten zasób posiadaopublikowaną wersję." -#: templates/catalogue/book_detail.html:65 -msgid "HTML version" -msgstr "Wersja HTML" +#: templates/catalogue/book_text.html:83 +msgid "This resource hasn't been published yet." +msgstr "Ten zasób nie został jeszcze opublikowany." -#: templates/catalogue/book_detail.html:66 -msgid "TXT version" -msgstr "Wersja TXT" +#: templates/catalogue/book_text.html:89 +msgid "Do you really want to publish this revision?" +msgstr "Na pewno chcesz opublikować tę rewizję?" -#: templates/catalogue/book_detail.html:67 -msgid "PDF version" -msgstr "Wersja PDF" +#: templates/catalogue/book_text.html:94 +msgid "" +"When the resource is ready for use, you can mark its specific revision as " +"published here." +msgstr "" +"Kiedy zasób jest gotowy do użytku, możesz oznaczyć go jako opublikowany." -#: templates/catalogue/book_detail.html:68 -msgid "EPUB version" -msgstr "Wersja EPUB" +#: templates/catalogue/book_text.html:95 +msgid "Publish this revision" +msgstr "Opublikuj tę rewizję" -#: templates/catalogue/book_detail.html:81 -msgid "Publish" -msgstr "Opublikuj" +#: templates/catalogue/book_text.html:99 +msgid "Do you really want to undo publishing this resource?" +msgstr "Na pewno chcesz wycofać publikację tego zasobu?" -#: templates/catalogue/book_detail.html:85 -msgid "Log in to publish." -msgstr "Zaloguj się, aby opublikować." +#: templates/catalogue/book_text.html:103 +msgid "" +"If you have published the resource by mistake, you can un-publish it here." +msgstr "" +"Jeśli zasób został opublikowany przez pomyłkę, możesz to cofnąć tutaj." -#: 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_text.html:104 +msgid "Undo publishing this resource" +msgstr "Wycofaj publikację tego zasobu" -#: templates/catalogue/book_detail.html:98 -msgid "Comments" -msgstr "Komentarze" +#: templates/catalogue/book_text.html:152 +#: templates/catalogue/document_create_missing.html:57 +#: templates/catalogue/finished.html:24 templates/catalogue/upcoming.html:24 +msgid "Audience" +msgstr "Odbiorcy" -#: templates/catalogue/book_text.html:7 -msgid "Redakcja" +#: templates/catalogue/book_text.html:157 +msgid "" +"You can download and share a PDF version – and more formats in the future." msgstr "" +"Możesz pobrać i opublikować wersję PDF – a w przyszłości również inne formaty." -#: templates/catalogue/book_text.html:15 -msgid "Table of contents" -msgstr "Spis treści" +#: templates/catalogue/book_text.html:159 +msgid "Download PDF" +msgstr "Pobierz PDF" -#: templates/catalogue/book_text.html:17 -msgid "Edit. note" -msgstr "Nota red." +#: templates/catalogue/book_text.html:166 +msgid "" +"And, of course, you can read and share the resource in a handy webpage form " +"right here." +msgstr "" +"I, oczywiście, możesz czytać zasób i dzielić się nim w postaci strony internetowej, właśnie tutaj." #: templates/catalogue/chunk_add.html:5 templates/catalogue/chunk_edit.html:18 msgid "Split chunk" @@ -258,15 +331,115 @@ msgstr "Wstaw pustą część po" msgid "Add chunk" msgstr "Dodaj część" -#: templates/catalogue/chunk_edit.html:5 -#: templates/catalogue/book_list/chunk.html:6 -msgid "Chunk settings" -msgstr "Ustawienia części" - #: templates/catalogue/chunk_edit.html:10 msgid "Book" msgstr "Książka" +#: templates/catalogue/document_create_missing.html:5 +msgid "Create a new resource" +msgstr "Utwórz nowy zasób" + +#: templates/catalogue/document_create_missing.html:15 +msgid "" +"You can choose whether the resource should be owned by you or by your " +"organization. This can be changed later." +msgstr "" +"Możesz wybrać, czy właścicielem zasobu masz być Ty, czy Twoja organizacja. " +"Można to zmienić później." + +#: templates/catalogue/document_create_missing.html:27 +msgid "Cover image" +msgstr "Obraz na okładkę" + +#: templates/catalogue/document_create_missing.html:30 +msgid "Language" +msgstr "Język" + +#: templates/catalogue/document_create_missing.html:33 +msgid "Publisher" +msgstr "Wydawca" + +#: templates/catalogue/document_create_missing.html:36 +msgid "Rights" +msgstr "Prawa autorskie" + +#: templates/catalogue/document_create_missing.html:40 +msgid "" +"You should choose a free license for your resource. We recommend using " +"Creative Commons Attribution - Share Alike." +msgstr "" +"Wybierz wolną licencję dla swojego zasobu. Rekomendujemy " +"Creative Commons Uznanie autorstwa - Na tych samych warunkach." + +#: templates/catalogue/document_create_missing.html:44 +msgid "Only set for resources that are not restricted with copyright." +msgstr "Tylko dla zasobów nie objętych majątkowym prawem autorskim" + +#: templates/catalogue/document_create_missing.html:45 +msgid "public domain" +msgstr "domena publiczna" + +#: templates/catalogue/document_create_missing.html:47 +msgid "" +"Non-copyleft free culture license. See creativecommons.org" +msgstr "" +"Nie-copyleftowa licencja wolnej kultury. Zob. creativecommons.org" + +#: templates/catalogue/document_create_missing.html:48 +msgid "Creative Commons Attribution" +msgstr "Creative Commons Uznanie autorstwa" + +#: templates/catalogue/document_create_missing.html:50 +msgid "" +"Copyleft free culture license. See creativecommons.org" +msgstr "" +"Copyleftowa licencja wolnej kultury. Zob. creativecommons.org" + +#: templates/catalogue/document_create_missing.html:51 +msgid "Creative Commons Attribution – Share Alike" +msgstr "Creative Commons Uznanie autorstwa – Na tych samych warunkach" + +#: templates/catalogue/document_create_missing.html:53 +msgid "" +"Copyleft free culture license. See artlibre.org" +msgstr "" +"Copyleftowa licencja wolnej kultury. Zob. artlibre.org" + + +#: templates/catalogue/document_create_missing.html:54 +msgid "Free Art License" +msgstr "Licencja Wolnej Sztuki (FAL)" + +#: templates/catalogue/document_create_missing.html:61 +msgid "Choose primary audience for your resource." +msgstr "Wybierz główną grupę odbiorców Twojego zasobu" + +#: templates/catalogue/document_create_missing.html:71 +msgid "Summary" +msgstr "Podsumowanie" + +#: templates/catalogue/document_create_missing.html:75 +msgid "You can provide a short description of the document here." +msgstr "Możesz tu dodać krótki opis dokumentu." + +#: templates/catalogue/document_create_missing.html:79 +msgid "Create resource" +msgstr "Utwórz zasób" + +#: templates/catalogue/document_fork.html:5 +msgid "Create another version of a resource" +msgstr "Utwórz odrębną wersję zasobu" + +#: templates/catalogue/document_fork.html:11 +msgid "Create as" +msgstr "Utwórz jako" + #: templates/catalogue/document_upload.html:8 msgid "Bulk documents upload" msgstr "Hurtowe dodawanie dokumentów" @@ -312,18 +485,30 @@ 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:21 -msgid "Your last edited documents" -msgstr "Twoje ostatnie edycje" +#: templates/catalogue/finished.html:8 +msgid "Finished resources" +msgstr "Ukończone zasoby" -#: templates/catalogue/my_page.html:30 templates/catalogue/user_page.html:13 -msgid "Recent activity for" -msgstr "Ostatnia aktywność dla:" +#: templates/catalogue/my_page.html:10 +msgid "New resource +" +msgstr "Nowy zasób +" + +#: templates/catalogue/my_page.html:15 +msgid "Projects" +msgstr "Projekty" -#: templates/catalogue/user_list.html:7 templatetags/catalogue.py:31 +#: templates/catalogue/upcoming.html:8 +msgid "Upcoming resources" +msgstr "Nadchodzące zasoby" + +#: templates/catalogue/user_list.html:7 msgid "Users" msgstr "Użytkownicy" +#: templates/catalogue/user_page.html:13 +msgid "Recent activity for" +msgstr "Ostatnia aktywność dla:" + #: templates/catalogue/wall.html:28 msgid "not logged in" msgstr "nie zalogowany" @@ -332,92 +517,162 @@ msgstr "nie zalogowany" msgid "No activity recorded." msgstr "Nie zanotowano aktywności." -#: templates/catalogue/book_list/book_list.html:27 -msgid "stage" -msgstr "etap" - -#: templates/catalogue/book_list/book_list.html:29 -#: templates/catalogue/book_list/book_list.html:40 -#: templates/catalogue/book_list/book_list.html:51 -msgid "none" -msgstr "brak" - -#: templates/catalogue/book_list/book_list.html:38 -msgid "editor" -msgstr "redaktor" - -#: templates/catalogue/book_list/book_list.html:76 -#, python-format -msgid "%(c)s module" -msgid_plural "%(c)s modules" -msgstr[0] "%(c)s moduł" -msgstr[1] "%(c)s moduły" -msgstr[2] "%(c)s modułów" - -#: templates/catalogue/book_list/book_list.html:87 -msgid "Set stage" -msgstr "Ustaw etap" - -#: templates/catalogue/book_list/book_list.html:88 -msgid "Set user" -msgstr "Przypisz redaktora" - -#: templates/catalogue/book_list/book_list.html:91 -msgid "Mark publishable" -msgstr "Oznacz do publikacji" - -#: templates/catalogue/book_list/book_list.html:92 -msgid "Mark not publishable" -msgstr "Odznacz do publikacji" - -#: templates/catalogue/book_list/book_list.html:93 -msgid "Other user" -msgstr "Inny użytkownik" - -#: templatetags/book_list.py:84 +#: templatetags/document_list.py:85 msgid "publishable" msgstr "do publikacji" -#: templatetags/book_list.py:85 +#: templatetags/document_list.py:86 msgid "changed" msgstr "zmienione" -#: templatetags/book_list.py:86 +#: templatetags/document_list.py:87 msgid "published" msgstr "opublikowane" -#: templatetags/book_list.py:87 +#: templatetags/document_list.py:88 msgid "unpublished" msgstr "nie opublikowane" -#: templatetags/book_list.py:88 +#: templatetags/document_list.py:89 msgid "empty" msgstr "puste" -#: templatetags/catalogue.py:27 -msgid "My page" -msgstr "Moja strona" - -#: templatetags/catalogue.py:30 -msgid "All" -msgstr "Wszystkie" - -#: templatetags/catalogue.py:34 -msgid "Add" -msgstr "Dodaj" - #: templatetags/wall.py:49 msgid "Related edit" msgstr "Powiązana zmiana" -#: templatetags/wall.py:51 -msgid "Edit" -msgstr "Zmiana" +#: templatetags/wall.py:78 +msgid "Publication" +msgstr "Publikacja" #: templatetags/wall.py:99 msgid "Comment" msgstr "Komentarz" +#: views.py:206 +#, python-format +msgid "Slug already used for %s" +msgstr "Slug taki sam jak dla pliku %s" + +#: views.py:208 +msgid "Slug already used in repository." +msgstr "Dokument o tym slugu już istnieje w repozytorium." + +#: views.py:214 +msgid "File should be UTF-8 encoded." +msgstr "Plik powinien mieć kodowanie UTF-8." + +#~ msgid "You must select a template" +#~ msgstr "Musisz wybrać szablon" + +#~ msgid "Append to" +#~ msgstr "Dołącz do" + +#~ msgid "book" +#~ msgstr "książka" + +#~ msgid "books" +#~ msgstr "książki" + +#~ msgid "number" +#~ msgstr "numer" + +#~ msgid "gallery start" +#~ msgstr "początek galerii" + +#~ msgid "chunk" +#~ msgstr "część" + +#~ msgid "chunks" +#~ msgstr "części" + +#~ msgid "name" +#~ msgstr "nazwa" + +#~ msgid "notes" +#~ msgstr "notatki" + +#~ msgid "chunk publish record" +#~ msgstr "zapis publikacji części" + +#~ msgid "chunk publish records" +#~ msgstr "zapisy publikacji części" + +#~ msgid "Platforma Redakcyjna" +#~ msgstr "Platforma Redakcyjna" + +#~ msgid "Edit gallery" +#~ msgstr "Edytuj galerię" + +#~ msgid "Append to other book" +#~ msgstr "Dołącz do innej książki" + +#~ msgid "Chunks" +#~ msgstr "Części" + +#~ msgid "Last published" +#~ msgstr "Ostatnio opublikowano" + +#~ msgid "Full XML" +#~ msgstr "Pełny XML" + +#~ msgid "HTML version" +#~ msgstr "Wersja HTML" + +#~ msgid "TXT version" +#~ msgstr "Wersja TXT" + +#~ msgid "PDF version" +#~ msgstr "Wersja PDF" + +#~ msgid "EPUB version" +#~ msgstr "Wersja EPUB" + +#~ msgid "Log in to publish." +#~ msgstr "Zaloguj się, aby opublikować." + +#~ msgid "Table of contents" +#~ msgstr "Spis treści" + +#~ msgid "Edit. note" +#~ msgstr "Nota red." + +#~ msgid "Your last edited documents" +#~ msgstr "Twoje ostatnie edycje" + +#~ msgid "none" +#~ msgstr "brak" + +#~ msgid "editor" +#~ msgstr "redaktor" + +#~ msgid "%(c)s module" +#~ msgid_plural "%(c)s modules" +#~ msgstr[0] "%(c)s moduł" +#~ msgstr[1] "%(c)s moduły" +#~ msgstr[2] "%(c)s modułów" + +#~ msgid "Set user" +#~ msgstr "Przypisz redaktora" + +#~ msgid "Mark publishable" +#~ msgstr "Oznacz do publikacji" + +#~ msgid "Mark not publishable" +#~ msgstr "Odznacz do publikacji" + +#~ msgid "Other user" +#~ msgstr "Inny użytkownik" + +#~ msgid "My page" +#~ msgstr "Moja strona" + +#~ msgid "All" +#~ msgstr "Wszystkie" + +#~ msgid "Add" +#~ msgstr "Dodaj" + #~ msgid "Text file must be UTF-8 encoded." #~ msgstr "Plik powinien mieć kodowanie UTF-8." @@ -436,12 +691,6 @@ msgstr "Komentarz" #~ msgid "projects" #~ msgstr "projekty" -#~ msgid "Create a new book" -#~ msgstr "Utwórz nową książkę" - -#~ msgid "Create book" -#~ msgstr "Utwórz książkę" - #~ msgid "Book settings" #~ msgstr "Ustawienia książki" @@ -454,12 +703,6 @@ msgstr "Komentarz" #~ msgid "status" #~ msgstr "status" -#~ msgid "No books found." -#~ msgstr "Nie znaleziono książek." - -#~ msgid "Project" -#~ msgstr "Projekt" - #~ msgid "Covers" #~ msgstr "Okładki" @@ -547,9 +790,6 @@ msgstr "Komentarz" #~ msgid "Help" #~ msgstr "Pomoc" -#~ msgid "Version" -#~ msgstr "Wersja" - #~ msgid "Unknown" #~ msgstr "nieznana" @@ -562,9 +802,6 @@ msgstr "Komentarz" #~ msgid "Clear filter" #~ msgstr "Wyczyść filtr" -#~ msgid "Cancel" -#~ msgstr "Anuluj" - #~ msgid "Revert" #~ msgstr "Przywróć" @@ -622,24 +859,9 @@ msgstr "Komentarz" #~ msgid "Search and replace" #~ msgstr "Znajdź i zamień" -#~ msgid "Source code" -#~ msgstr "Kod źródłowy" - -#~ msgid "Title" -#~ msgstr "Tytuł" - -#~ msgid "Document ID" -#~ msgstr "ID dokumentu" - -#~ msgid "Current version" -#~ msgstr "Aktualna wersja" - #~ msgid "Last edited by" #~ msgstr "Ostatnio edytowane przez" -#~ msgid "Summary" -#~ msgstr "Podsumowanie" - #~ msgid "Insert theme" #~ msgstr "Wstaw motyw" @@ -676,8 +898,5 @@ msgstr "Komentarz" #~ msgid "Technical Editor's Proofreading" #~ msgstr "Ostateczna redakcja techniczna" -#~ msgid "Finished stage: %s" -#~ msgstr "Ukończony etap: %s" - #~ msgid "Refresh" #~ msgstr "Odśwież" diff --git a/apps/catalogue/management/commands/assign_from_redmine.py b/apps/catalogue/management/commands/assign_from_redmine.py deleted file mode 100644 index 9f7b12d4..00000000 --- a/apps/catalogue/management/commands/assign_from_redmine.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- coding: utf-8 -*- - -import csv -from optparse import make_option -import re -import sys -import urllib -import urllib2 - -from django.contrib.auth.models import User -from django.core.management.base import BaseCommand -from django.core.management.color import color_style -from django.db import transaction - -from slughifi import slughifi -from catalogue.models import Chunk - - -REDMINE_CSV = 'http://redmine.nowoczesnapolska.org.pl/projects/wl-publikacje/issues.csv' -REDAKCJA_URL = 'http://redakcja.wolnelektury.pl/documents/' - - -class Command(BaseCommand): - option_list = BaseCommand.option_list + ( - make_option('-r', '--redakcja', dest='redakcja', metavar='URL', - help='Base URL of Redakcja documents', - default=REDAKCJA_URL), - make_option('-q', '--quiet', action='store_false', dest='verbose', default=True, - help='Less output'), - make_option('-f', '--force', action='store_true', dest='force', default=False, - help='Force assignment overwrite'), - ) - help = 'Imports ticket assignments from Redmine.' - args = '[redmine-csv-url]' - - def handle(self, *redmine_csv, **options): - - self.style = color_style() - - redakcja = options.get('redakcja') - verbose = options.get('verbose') - force = options.get('force') - - if not redmine_csv: - if verbose: - print "Using default Redmine CSV URL:", REDMINE_CSV - redmine_csv = REDMINE_CSV - - # Start transaction management. - transaction.commit_unless_managed() - transaction.enter_transaction_management() - transaction.managed(True) - - redakcja_link = re.compile(re.escape(redakcja) + r'([-_.:?&%/a-zA-Z0-9]*)') - - all_tickets = 0 - all_chunks = 0 - done_tickets = 0 - done_chunks = 0 - empty_users = 0 - unknown_users = {} - unknown_books = [] - forced = [] - - if verbose: - print 'Downloading CSV file' - for r in csv.reader(urllib2.urlopen(redmine_csv)): - if r[0] == '#': - continue - all_tickets += 1 - - username = r[6] - if not username: - if verbose: - print "Empty user, skipping" - empty_users += 1 - continue - - first_name, last_name = unicode(username, 'utf-8').rsplit(u' ', 1) - try: - user = User.objects.get(first_name=first_name, last_name=last_name) - except User.DoesNotExist: - print self.style.ERROR('Unknown user: ' + username) - unknown_users.setdefault(username, 0) - unknown_users[username] += 1 - continue - - ticket_done = False - for fname in redakcja_link.findall(r[-1]): - fname = unicode(urllib.unquote(fname), 'utf-8', 'ignore') - if fname.endswith('.xml'): - fname = fname[:-4] - fname = fname.replace(' ', '_') - fname = slughifi(fname) - - chunks = Chunk.objects.filter(book__slug=fname) - if not chunks: - print self.style.ERROR('Unknown book: ' + fname) - unknown_books.append(fname) - continue - all_chunks += chunks.count() - - for chunk in chunks: - if chunk.user: - if chunk.user == user: - continue - else: - forced.append((chunk, chunk.user, user)) - if force: - print self.style.WARNING( - '%s assigned to %s, forcing change to %s.' % - (chunk.pretty_name(), chunk.user, user)) - else: - print self.style.WARNING( - '%s assigned to %s not to %s, skipping.' % - (chunk.pretty_name(), chunk.user, user)) - continue - chunk.user = user - chunk.save() - ticket_done = True - done_chunks += 1 - - if ticket_done: - done_tickets += 1 - - - # Print results - print - print "Results:" - print "Assignments imported from %d/%d tickets to %d/%d relevalt chunks." % ( - done_tickets, all_tickets, done_chunks, all_chunks) - if empty_users: - print "%d tickets were unassigned." % empty_users - if forced: - print "%d assignments conficts (%s):" % ( - len(forced), "changed" if force else "left") - for chunk, orig, user in forced: - print " %s: \t%s \t-> %s" % ( - chunk.pretty_name(), orig.username, user.username) - if unknown_books: - print "%d unknown books:" % len(unknown_books) - for fname in unknown_books: - print " %s" % fname - if unknown_users: - print "%d unknown users:" % len(unknown_users) - for name in unknown_users: - print " %s (%d tickets)" % (name, unknown_users[name]) - print - - - transaction.commit() - transaction.leave_transaction_management() - diff --git a/apps/catalogue/management/commands/merge_books.py b/apps/catalogue/management/commands/merge_books.py deleted file mode 100644 index aec113ed..00000000 --- a/apps/catalogue/management/commands/merge_books.py +++ /dev/null @@ -1,218 +0,0 @@ -# -*- coding: utf-8 -*- - -from optparse import make_option -import sys - -from django.contrib.auth.models import User -from django.core.management.base import BaseCommand -from django.core.management.color import color_style -from django.db import transaction - -from slughifi import slughifi -from catalogue.models import Book - - -def common_prefix(texts): - common = [] - - min_len = min(len(text) for text in texts) - for i in range(min_len): - chars = list(set([text[i] for text in texts])) - if len(chars) > 1: - break - common.append(chars[0]) - return "".join(common) - - -class Command(BaseCommand): - option_list = BaseCommand.option_list + ( - make_option('-s', '--slug', dest='new_slug', metavar='SLUG', - help='New slug of the merged book (defaults to common part of all slugs).'), - make_option('-t', '--title', dest='new_title', metavar='TITLE', - help='New title of the merged book (defaults to common part of all titles).'), - make_option('-q', '--quiet', action='store_false', dest='verbose', default=True, - help='Less output'), - make_option('-g', '--guess', action='store_true', dest='guess', default=False, - help='Try to guess what merges are needed (but do not apply them).'), - make_option('-d', '--dry-run', action='store_true', dest='dry_run', default=False, - help='Dry run: do not actually change anything.'), - make_option('-f', '--force', action='store_true', dest='force', default=False, - help='On slug conflict, hide the original book to archive.'), - ) - help = 'Merges multiple books into one.' - args = '[slug]...' - - - def print_guess(self, dry_run=True, force=False): - from collections import defaultdict - from pipes import quote - import re - - def read_slug(slug): - res = [] - res.append((re.compile(ur'__?(przedmowa)$'), -1)) - res.append((re.compile(ur'__?(cz(esc)?|ksiega|rozdzial)__?(?P\d*)$'), None)) - res.append((re.compile(ur'__?(rozdzialy__?)?(?P\d*)-'), None)) - - for r, default in res: - m = r.search(slug) - if m: - start = m.start() - try: - return int(m.group('n')), slug[:start] - except IndexError: - return default, slug[:start] - return None, slug - - def file_to_title(fname): - """ Returns a title-like version of a filename. """ - parts = (p.replace('_', ' ').title() for p in fname.split('__')) - return ' / '.join(parts) - - merges = defaultdict(list) - slugs = [] - for b in Book.objects.all(): - slugs.append(b.slug) - n, ns = read_slug(b.slug) - if n is not None: - merges[ns].append((n, b)) - - conflicting_slugs = [] - for slug in sorted(merges.keys()): - merge_list = sorted(merges[slug]) - if len(merge_list) < 2: - continue - - merge_slugs = [b.slug for i, b in merge_list] - if slug in slugs and slug not in merge_slugs: - conflicting_slugs.append(slug) - - title = file_to_title(slug) - print "./manage.py merge_books %s%s--title=%s --slug=%s \\\n %s\n" % ( - '--dry-run ' if dry_run else '', - '--force ' if force else '', - quote(title), slug, - " \\\n ".join(merge_slugs) - ) - - if conflicting_slugs: - if force: - print self.style.NOTICE('# These books will be archived:') - else: - print self.style.ERROR('# ERROR: Conflicting slugs:') - for slug in conflicting_slugs: - print '#', slug - - - def handle(self, *slugs, **options): - - self.style = color_style() - - force = options.get('force') - guess = options.get('guess') - dry_run = options.get('dry_run') - new_slug = options.get('new_slug').decode('utf-8') - new_title = options.get('new_title').decode('utf-8') - verbose = options.get('verbose') - - if guess: - if slugs: - print "Please specify either slugs, or --guess." - return - else: - self.print_guess(dry_run, force) - return - if not slugs: - print "Please specify some book slugs" - return - - # Start transaction management. - transaction.commit_unless_managed() - transaction.enter_transaction_management() - transaction.managed(True) - - books = [Book.objects.get(slug=slug) for slug in slugs] - common_slug = common_prefix(slugs) - common_title = common_prefix([b.title for b in books]) - - if not new_title: - new_title = common_title - elif common_title.startswith(new_title): - common_title = new_title - - if not new_slug: - new_slug = common_slug - elif common_slug.startswith(new_slug): - common_slug = new_slug - - if slugs[0] != new_slug and Book.objects.filter(slug=new_slug).exists(): - self.style.ERROR('Book already exists, skipping!') - - - if dry_run and verbose: - print self.style.NOTICE('DRY RUN: nothing will be changed.') - print - - if verbose: - print "New title:", self.style.NOTICE(new_title) - print "New slug:", self.style.NOTICE(new_slug) - print - - for i, book in enumerate(books): - chunk_titles = [] - chunk_slugs = [] - - book_title = book.title[len(common_title):].replace(' / ', ' ').lstrip() - book_slug = book.slug[len(common_slug):].replace('__', '_').lstrip('-_') - for j, chunk in enumerate(book): - if j: - new_chunk_title = book_title + '_%d' % j - new_chunk_slug = book_slug + '_%d' % j - else: - new_chunk_title, new_chunk_slug = book_title, book_slug - - chunk_titles.append(new_chunk_title) - chunk_slugs.append(new_chunk_slug) - - if verbose: - print "title: %s // %s -->\n %s // %s\nslug: %s / %s -->\n %s / %s" % ( - book.title, chunk.title, - new_title, new_chunk_title, - book.slug, chunk.slug, - new_slug, new_chunk_slug) - print - - if not dry_run: - try: - conflict = Book.objects.get(slug=new_slug) - except Book.DoesNotExist: - conflict = None - else: - if conflict == books[0]: - conflict = None - - if conflict: - if force: - # FIXME: there still may be a conflict - conflict.slug = '.' + conflict.slug - conflict.save() - print self.style.NOTICE('Book with slug "%s" moved to "%s".' % (new_slug, conflict.slug)) - else: - print self.style.ERROR('ERROR: Book with slug "%s" exists.' % new_slug) - return - - if i: - books[0].append(books[i], slugs=chunk_slugs, titles=chunk_titles) - else: - book.title = new_title - book.slug = new_slug - book.save() - for j, chunk in enumerate(book): - chunk.title = chunk_titles[j] - chunk.slug = chunk_slugs[j] - chunk.save() - - - transaction.commit() - transaction.leave_transaction_management() - diff --git a/apps/catalogue/managers.py b/apps/catalogue/managers.py deleted file mode 100644 index 4f804b84..00000000 --- a/apps/catalogue/managers.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.db import models - -class VisibleManager(models.Manager): - def get_query_set(self): - return super(VisibleManager, self).get_query_set().exclude(_hidden=True) diff --git a/apps/catalogue/migrations/0001_initial.py b/apps/catalogue/migrations/0001_initial.py index dccd9b7b..bc459e6e 100644 --- a/apps/catalogue/migrations/0001_initial.py +++ b/apps/catalogue/migrations/0001_initial.py @@ -1,240 +1,59 @@ -# encoding: 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 'Book' - db.create_table('catalogue_book', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=128, db_index=True)), - ('gallery', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])), - ('parent_number', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True)), - ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('_single', self.gf('django.db.models.fields.NullBooleanField')(db_index=True, null=True, blank=True)), - ('_new_publishable', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_published', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - )) - db.send_create_signal('catalogue', ['Book']) - - # Adding model 'Chunk' - db.create_table('catalogue_chunk', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_documents', null=True, to=orm['auth.User'])), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])), - ('number', self.gf('django.db.models.fields.IntegerField')()), - ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)), - ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('_hidden', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('_changed', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)), - ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ChunkTag'], null=True, blank=True)), - ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ChunkChange'], null=True, blank=True)), - )) - db.send_create_signal('catalogue', ['Chunk']) - - # Adding unique constraint on 'Chunk', fields ['book', 'number'] - db.create_unique('catalogue_chunk', ['book_id', 'number']) - - # Adding unique constraint on 'Chunk', fields ['book', 'slug'] - db.create_unique('catalogue_chunk', ['book_id', 'slug']) - - # Adding model 'ChunkTag' - db.create_table('catalogue_chunktag', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=64)), - ('slug', self.gf('django.db.models.fields.SlugField')(db_index=True, max_length=64, unique=True, null=True, blank=True)), - ('ordering', self.gf('django.db.models.fields.IntegerField')()), - )) - db.send_create_signal('catalogue', ['ChunkTag']) - - # Adding model 'ChunkChange' - db.create_table('catalogue_chunkchange', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)), - ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)), - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ChunkChange'])), - ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ChunkChange'])), - ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)), - ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)), - ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Chunk'])), - ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)), - )) - db.send_create_signal('catalogue', ['ChunkChange']) - - # Adding unique constraint on 'ChunkChange', fields ['tree', 'revision'] - db.create_unique('catalogue_chunkchange', ['tree_id', 'revision']) - - # Adding M2M table for field tags on 'ChunkChange' - db.create_table('catalogue_chunkchange_tags', ( - ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)), - ('chunkchange', models.ForeignKey(orm['catalogue.chunkchange'], null=False)), - ('chunktag', models.ForeignKey(orm['catalogue.chunktag'], null=False)) - )) - db.create_unique('catalogue_chunkchange_tags', ['chunkchange_id', 'chunktag_id']) - - # Adding model 'BookPublishRecord' - db.create_table('catalogue_bookpublishrecord', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.Book'])), - ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), - )) - db.send_create_signal('catalogue', ['BookPublishRecord']) - - # Adding model 'ChunkPublishRecord' - db.create_table('catalogue_chunkpublishrecord', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('book_record', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.BookPublishRecord'])), - ('change', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.ChunkChange'])), - )) - db.send_create_signal('catalogue', ['ChunkPublishRecord']) - - - def backwards(self, orm): - - # Removing unique constraint on 'ChunkChange', fields ['tree', 'revision'] - db.delete_unique('catalogue_chunkchange', ['tree_id', 'revision']) - - # Removing unique constraint on 'Chunk', fields ['book', 'slug'] - db.delete_unique('catalogue_chunk', ['book_id', 'slug']) - - # Removing unique constraint on 'Chunk', fields ['book', 'number'] - db.delete_unique('catalogue_chunk', ['book_id', 'number']) - - # Deleting model 'Book' - db.delete_table('catalogue_book') - - # Deleting model 'Chunk' - db.delete_table('catalogue_chunk') - - # Deleting model 'ChunkTag' - db.delete_table('catalogue_chunktag') - - # Deleting model 'ChunkChange' - db.delete_table('catalogue_chunkchange') - - # Removing M2M table for field tags on 'ChunkChange' - db.delete_table('catalogue_chunkchange_tags') - - # Deleting model 'BookPublishRecord' - db.delete_table('catalogue_bookpublishrecord') - - # Deleting model 'ChunkPublishRecord' - db.delete_table('catalogue_chunkpublishrecord') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.contrib.auth.models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0006_require_contenttypes_0002'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('dvcs', '__first__'), + ('organizations', '__first__'), + ] + + operations = [ + migrations.CreateModel( + name='Document', + fields=[ + ('ref_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='dvcs.Ref')), + ('stage', models.CharField(default='', max_length=128, verbose_name='stage', blank=True)), + ('owner_organization', models.ForeignKey(to='organizations.Organization', null=True)), + ], + options={ + 'verbose_name': 'document', + 'verbose_name_plural': 'documents', + }, + bases=('dvcs.ref',), + ), + migrations.CreateModel( + name='Template', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=255)), + ('content', models.TextField()), + ('is_main', models.BooleanField()), + ('is_partial', models.BooleanField()), + ], + ), + migrations.CreateModel( + name='User', + fields=[ + ], + options={ + 'proxy': True, + }, + bases=('auth.user',), + managers=[ + (b'objects', django.contrib.auth.models.UserManager()), + ], + ), + migrations.AddField( + model_name='document', + name='owner_user', + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True), + ), + ] diff --git a/apps/catalogue/migrations/0002_document_assigned_to.py b/apps/catalogue/migrations/0002_document_assigned_to.py new file mode 100644 index 00000000..366d0e81 --- /dev/null +++ b/apps/catalogue/migrations/0002_document_assigned_to.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('catalogue', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='document', + name='assigned_to', + field=models.ForeignKey(related_name='assignments', to=settings.AUTH_USER_MODEL, null=True), + ), + ] diff --git a/apps/catalogue/migrations/0002_stages.py b/apps/catalogue/migrations/0002_stages.py deleted file mode 100644 index 71554570..00000000 --- a/apps/catalogue/migrations/0002_stages.py +++ /dev/null @@ -1,122 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - - from django.core.management import call_command - call_command("loaddata", "stages.json") - - - def backwards(self, orm): - "Write your backwards methods here." - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0003_from_hg.py b/apps/catalogue/migrations/0003_from_hg.py deleted file mode 100644 index d8360676..00000000 --- a/apps/catalogue/migrations/0003_from_hg.py +++ /dev/null @@ -1,281 +0,0 @@ -# encoding: utf-8 -import datetime -from zlib import compress -import os -import os.path -import re -import urllib - -from django.db import models -from south.db import db -from south.v2 import DataMigration - -from django.conf import settings -from slughifi import slughifi - -META_REGEX = re.compile(r'\s*', re.DOTALL | re.MULTILINE) -STAGE_TAGS_RE = re.compile(r'^#stage-finished: (.*)$', re.MULTILINE) -AUTHOR_RE = re.compile(r'\s*(.*?)\s*<(.*)>\s*') - - -def urlunquote(url): - """Unqotes URL - - # >>> urlunquote('Za%C5%BC%C3%B3%C5%82%C4%87_g%C4%99%C5%9Bl%C4%85_ja%C5%BA%C5%84') - # u'Za\u017c\xf3\u0142\u0107_g\u0119\u015bl\u0105 ja\u017a\u0144' - """ - return unicode(urllib.unquote(url), 'utf-8', 'ignore') - - -def split_name(name): - parts = name.split('__') - return parts - - -def file_to_title(fname): - """ Returns a title-like version of a filename. """ - parts = (p.replace('_', ' ').title() for p in fname.split('__')) - return ' / '.join(parts) - - -def plain_text(text): - return re.sub(META_REGEX, '', text, 1) - - -def gallery(slug, text): - result = {} - - m = re.match(META_REGEX, text) - if m: - for line in m.group(1).split('\n'): - try: - k, v = line.split(':', 1) - result[k.strip()] = v.strip() - except ValueError: - continue - - gallery = result.get('gallery', slughifi(slug)) - - if gallery.startswith('/'): - gallery = os.path.basename(gallery) - - return gallery - - -def migrate_file_from_hg(orm, fname, entry): - fname = urlunquote(fname) - print fname - if fname.endswith('.xml'): - fname = fname[:-4] - title = file_to_title(fname) - fname = slughifi(fname) - - # create all the needed objects - # what if it already exists? - book = orm.Book.objects.create( - title=title, - slug=fname) - chunk = orm.Chunk.objects.create( - book=book, - number=1, - slug='1') - try: - chunk.stage = orm.ChunkTag.objects.order_by('ordering')[0] - except IndexError: - chunk.stage = None - - maxrev = entry.filerev() - gallery_link = None - - # this will fail if directory exists - os.makedirs(os.path.join(settings.CATALOGUE_REPO_PATH, str(chunk.pk))) - - for rev in xrange(maxrev + 1): - fctx = entry.filectx(rev) - data = fctx.data() - gallery_link = gallery(fname, data) - data = plain_text(data) - - # get tags from description - description = fctx.description().decode("utf-8", 'replace') - tags = STAGE_TAGS_RE.findall(description) - tags = [orm.ChunkTag.objects.get(slug=slug.strip()) for slug in tags] - - if tags: - max_ordering = max(tags, key=lambda x: x.ordering).ordering - try: - chunk.stage = orm.ChunkTag.objects.filter(ordering__gt=max_ordering).order_by('ordering')[0] - except IndexError: - chunk.stage = None - - description = STAGE_TAGS_RE.sub('', description) - - author = author_name = author_email = None - author_desc = fctx.user().decode("utf-8", 'replace') - m = AUTHOR_RE.match(author_desc) - if m: - try: - author = orm['auth.User'].objects.get(username=m.group(1), email=m.group(2)) - except orm['auth.User'].DoesNotExist: - author_name = m.group(1) - author_email = m.group(2) - else: - author_name = author_desc - - head = orm.ChunkChange.objects.create( - tree=chunk, - revision=rev + 1, - created_at=datetime.datetime.fromtimestamp(fctx.date()[0]), - description=description, - author=author, - author_name=author_name, - author_email=author_email, - parent=chunk.head - ) - - path = "%d/%d" % (chunk.pk, head.pk) - abs_path = os.path.join(settings.CATALOGUE_REPO_PATH, path) - f = open(abs_path, 'wb') - f.write(compress(data)) - f.close() - head.data = path - - head.tags = tags - head.save() - - chunk.head = head - - chunk.save() - if gallery_link: - book.gallery = gallery_link - book.save() - - -class Migration(DataMigration): - - def forwards(self, orm): - try: - hg_path = settings.WIKI_REPOSITORY_PATH - 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'] - for fname in tip: - if fname.startswith('.'): - continue - migrate_file_from_hg(orm, fname, tip[fname]) - - - def backwards(self, orm): - "Write your backwards methods here." - pass - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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_documents'", 'null': 'True', 'to': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0003_plan.py b/apps/catalogue/migrations/0003_plan.py new file mode 100644 index 00000000..1457971f --- /dev/null +++ b/apps/catalogue/migrations/0003_plan.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('catalogue', '0002_document_assigned_to'), + ] + + operations = [ + migrations.CreateModel( + name='Plan', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('stage', models.CharField(max_length=128)), + ('deadline', models.DateField(null=True, blank=True)), + ('document', models.ForeignKey(to='catalogue.Document')), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, null=True)), + ], + ), + ] diff --git a/apps/catalogue/migrations/0004_fix_revisions.py b/apps/catalogue/migrations/0004_fix_revisions.py deleted file mode 100644 index fe5c86be..00000000 --- a/apps/catalogue/migrations/0004_fix_revisions.py +++ /dev/null @@ -1,125 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - "Make sure all revisions start with 1, not 0." - for zero_commit in orm.ChunkChange.objects.filter(revision=0): - for change in zero_commit.tree.change_set.all().order_by('-revision'): - change.revision=models.F('revision') + 1 - change.save() - - - def backwards(self, orm): - "Write your backwards methods here." - pass - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "orm['auth.User']"}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0004_publishrecord.py b/apps/catalogue/migrations/0004_publishrecord.py new file mode 100644 index 00000000..87d092ac --- /dev/null +++ b/apps/catalogue/migrations/0004_publishrecord.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('dvcs', '0001_initial'), + ('catalogue', '0003_plan'), + ] + + operations = [ + migrations.CreateModel( + name='PublishRecord', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='time')), + ('document', models.ForeignKey(related_name='publish_log', verbose_name='document', to='catalogue.Document')), + ('revision', models.ForeignKey(related_name='publish_log', verbose_name='revision', to='dvcs.Revision')), + ('user', models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-timestamp'], + 'verbose_name': 'book publish records', + }, + ), + ] diff --git a/apps/catalogue/migrations/0005_auto_20150505_1229.py b/apps/catalogue/migrations/0005_auto_20150505_1229.py new file mode 100644 index 00000000..b771a26f --- /dev/null +++ b/apps/catalogue/migrations/0005_auto_20150505_1229.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0004_publishrecord'), + ] + + operations = [ + migrations.AddField( + model_name='document', + name='deleted', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='document', + name='stage', + field=models.CharField(default=b'Draft', max_length=128, verbose_name='stage', blank=True), + ), + ] diff --git a/apps/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py b/apps/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py deleted file mode 100644 index 71af5f6c..00000000 --- a/apps/catalogue/migrations/0005_auto__add_field_chunk_gallery_start.py +++ /dev/null @@ -1,125 +0,0 @@ -# encoding: 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 field 'Chunk.gallery_start' - db.add_column('catalogue_chunk', 'gallery_start', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Chunk.gallery_start' - db.delete_column('catalogue_chunk', 'gallery_start') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'}, - '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0006_auto__add_field_book_public.py b/apps/catalogue/migrations/0006_auto__add_field_book_public.py deleted file mode 100644 index fd1cea56..00000000 --- a/apps/catalogue/migrations/0006_auto__add_field_book_public.py +++ /dev/null @@ -1,126 +0,0 @@ -# encoding: 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 field 'Book.public' - db.add_column('catalogue_book', 'public', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book.public' - db.delete_column('catalogue_book', 'public') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "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'}), - '_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'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "orm['auth.User']"}), - 'gallery_start': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0007_auto__add_field_book_dc_slug.py b/apps/catalogue/migrations/0007_auto__add_field_book_dc_slug.py deleted file mode 100644 index 5ae20ea3..00000000 --- a/apps/catalogue/migrations/0007_auto__add_field_book_dc_slug.py +++ /dev/null @@ -1,127 +0,0 @@ -# encoding: 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 field 'Book.dc_slug' - db.add_column('catalogue_book', 'dc_slug', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book.dc_slug' - db.delete_column('catalogue_book', 'dc_slug') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "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'}), - '_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_slug': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}), - 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}), - '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'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "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'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0008_auto.py b/apps/catalogue/migrations/0008_auto.py deleted file mode 100644 index 5276b27b..00000000 --- a/apps/catalogue/migrations/0008_auto.py +++ /dev/null @@ -1,127 +0,0 @@ -# encoding: 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 index on 'Book', fields ['dc_slug'] - db.create_index('catalogue_book', ['dc_slug']) - - - def backwards(self, orm): - - # Removing index on 'Book', fields ['dc_slug'] - db.delete_index('catalogue_book', ['dc_slug']) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "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'}), - '_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_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'}), - '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'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "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'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0009_auto__add_field_book__on_track.py b/apps/catalogue/migrations/0009_auto__add_field_book__on_track.py deleted file mode 100644 index f0509c42..00000000 --- a/apps/catalogue/migrations/0009_auto__add_field_book__on_track.py +++ /dev/null @@ -1,128 +0,0 @@ -# encoding: 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 field 'Book._on_track' - db.add_column('catalogue_book', '_on_track', self.gf('django.db.models.fields.IntegerField')(db_index=True, null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book._on_track' - db.delete_column('catalogue_book', '_on_track') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "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_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'}), - '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'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}), - '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']"}), - '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': "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': "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'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'number': ('django.db.models.fields.IntegerField', [], {}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}) - }, - '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'}), - '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'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py b/apps/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py deleted file mode 100644 index aebbed95..00000000 --- a/apps/catalogue/migrations/0010_auto__add_field_book_dc_cover_image.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - depends_on = ( - ("cover", "0001_initial"), - ) - - def forwards(self, orm): - # Adding field 'Book.dc_cover_image' - db.add_column('catalogue_book', 'dc_cover_image', - self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cover.Image'], null=True, on_delete=models.SET_NULL, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Book.dc_cover_image' - db.delete_column('catalogue_book', 'dc_cover_image_id') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - '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': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - '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': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - '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': "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': "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'}), - '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'}), - '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']"}), - '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': "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': "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'}), - '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': "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': "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'}), - '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']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) - }, - 'catalogue.chunktag': { - 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'}, - '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'}) - }, - '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'}), - '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'}) - }, - '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'}), - '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/migrations/0011_auto__add_project__add_field_book_project.py b/apps/catalogue/migrations/0011_auto__add_project__add_field_book_project.py deleted file mode 100644 index 6f30cb4f..00000000 --- a/apps/catalogue/migrations/0011_auto__add_project__add_field_book_project.py +++ /dev/null @@ -1,159 +0,0 @@ -# -*- 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/migrations/0012_auto__add_template.py b/apps/catalogue/migrations/0012_auto__add_template.py deleted file mode 100644 index f9ce8989..00000000 --- a/apps/catalogue/migrations/0012_auto__add_template.py +++ /dev/null @@ -1,157 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as 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 'Template' - db.create_table(u'catalogue_template', ( - (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('content', self.gf('django.db.models.fields.TextField')()), - )) - db.send_create_signal(u'catalogue', ['Template']) - - - def backwards(self, orm): - # Deleting model 'Template' - db.delete_table(u'catalogue_template') - - - 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', 'blank': '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'catalogue.template': { - 'Meta': {'object_name': 'Template'}, - 'content': ('django.db.models.fields.TextField', [], {}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - }, - 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', [], {'max_length': '200', 'unique': 'True', 'null': 'True'}), - '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', 'null': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['catalogue'] \ No newline at end of file diff --git a/apps/catalogue/migrations/0013_auto__add_field_template_is_main__add_field_template_is_partial.py b/apps/catalogue/migrations/0013_auto__add_field_template_is_main__add_field_template_is_partial.py deleted file mode 100644 index 0d83e6d1..00000000 --- a/apps/catalogue/migrations/0013_auto__add_field_template_is_main__add_field_template_is_partial.py +++ /dev/null @@ -1,164 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Template.is_main' - db.add_column(u'catalogue_template', 'is_main', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - # Adding field 'Template.is_partial' - db.add_column(u'catalogue_template', 'is_partial', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Template.is_main' - db.delete_column(u'catalogue_template', 'is_main') - - # Deleting field 'Template.is_partial' - db.delete_column(u'catalogue_template', 'is_partial') - - - 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', 'blank': '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'}) - }, - 'catalogue.template': { - 'Meta': {'object_name': 'Template'}, - 'content': ('django.db.models.fields.TextField', [], {}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_partial': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - }, - 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', [], {'max_length': '200', 'unique': 'True', 'null': 'True'}), - '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', 'null': 'True'}), - '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 faa2d384..c2a067d7 100755 --- a/apps/catalogue/models/__init__.py +++ b/apps/catalogue/models/__init__.py @@ -4,11 +4,11 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from catalogue.models.template import Template -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 -from catalogue.models.listeners import * +from catalogue.models.document import Document +from catalogue.models.plan import Plan +from catalogue.models.publish_log import PublishRecord +#from catalogue.models.book import Book +#from catalogue.models.listeners import * from django.contrib.auth.models import User as AuthUser diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index f07c9a83..34ac796c 100755 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.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 django.contrib.auth.models import User from django.contrib.sites.models import Site from django.db import models, transaction from django.template.loader import render_to_string @@ -10,7 +11,6 @@ from django.utils.translation import ugettext_lazy as _ from django.conf import settings from slughifi import slughifi - import apiclient from catalogue.helpers import cached_in_field, GalleryMerger from catalogue.models import BookPublishRecord, ChunkPublishRecord, Project @@ -18,10 +18,12 @@ from catalogue.signals import post_publish from catalogue.tasks import refresh_instance, book_content_updated from catalogue.xml_tools import compile_text, split_xml from cover.models import Image +from organizations.models import Organization import os import shutil import re + class Book(models.Model): """ A document edited on the wiki """ @@ -31,6 +33,9 @@ class Book(models.Model): gallery = models.CharField(u'materiały', max_length=255, blank=True) project = models.ForeignKey(Project, null=True, blank=True) + owner_user = models.ForeignKey(User, null=True) + owner_organization = models.ForeignKey(Organization, 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) parent_number = models.IntegerField(_('parent number'), null=True, blank=True, db_index=True, editable=False) @@ -320,7 +325,7 @@ class Book(models.Model): return len(self) == 1 single = cached_in_field('_single')(is_single) - @cached_in_field('_short_html') + #@cached_in_field('_short_html') def short_html(self): return render_to_string('catalogue/book_list/book.html', {'book': self}) diff --git a/apps/catalogue/models/chunk.py b/apps/catalogue/models/chunk.py deleted file mode 100755 index 70e185bb..00000000 --- a/apps/catalogue/models/chunk.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- 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.conf import settings -from django.db import models -from django.db.utils import IntegrityError -from django.template.loader import render_to_string -from django.utils.translation import ugettext_lazy as _ -from catalogue.helpers import cached_in_field -from catalogue.managers import VisibleManager -from catalogue.tasks import refresh_instance -from dvcs import models as dvcs_models - - -class Chunk(dvcs_models.Document): - """ An editable chunk of text. Every Book text is divided into chunks. """ - REPO_PATH = settings.CATALOGUE_REPO_PATH - - book = models.ForeignKey('Book', editable=False, verbose_name=_('book')) - number = models.IntegerField(_('number')) - title = models.CharField(_('title'), max_length=255, blank=True) - slug = models.SlugField(_('slug')) - gallery_start = models.IntegerField(_('gallery start'), null=True, blank=True, default=1) - - # cache - _short_html = models.TextField(null=True, blank=True, editable=False) - _hidden = models.NullBooleanField(editable=False) - _changed = models.NullBooleanField(editable=False) - - # managers - objects = models.Manager() - visible_objects = VisibleManager() - - class Meta: - app_label = 'catalogue' - unique_together = [['book', 'number'], ['book', 'slug']] - ordering = ['number'] - verbose_name = _('chunk') - verbose_name_plural = _('chunks') - permissions = [('can_pubmark', 'Can mark for publishing')] - - class TagMeta: - verbose_name = u'etap pracy' - verbose_name_plural = u'etapy pracy' - - # Representing - # ============ - - def __unicode__(self): - return "%d:%d: %s" % (self.book_id, self.number, self.title) - - @models.permalink - def get_absolute_url(self): - return ("wiki_editor", [self.book.slug, self.slug]) - - def pretty_name(self, book_length=None): - title = self.book.title - if self.title: - title += ", %s" % self.title - if book_length > 1: - title += " (%d/%d)" % (self.number, book_length) - return title - - - # Creating and manipulation - # ========================= - - def split(self, slug, title='', **kwargs): - """ Create an empty chunk after this one """ - self.book.chunk_set.filter(number__gt=self.number).update( - number=models.F('number')+1) - new_chunk = None - while not new_chunk: - new_slug = self.book.make_chunk_slug(slug) - try: - new_chunk = self.book.chunk_set.create(number=self.number+1, - slug=new_slug[:50], title=title[:255], **kwargs) - except IntegrityError: - pass - return new_chunk - - @classmethod - def get(cls, book_slug, chunk_slug=None): - if chunk_slug is None: - return cls.objects.get(book__slug=book_slug, number=1) - else: - return cls.objects.get(book__slug=book_slug, slug=chunk_slug) - - - # State & cache - # ============= - - def new_publishable(self): - change = self.publishable() - if not change: - return False - return change.publish_log.exists() - - def is_changed(self): - if self.head is None: - return False - return not self.head.publishable - changed = cached_in_field('_changed')(is_changed) - - def is_hidden(self): - return self.book.hidden() - hidden = cached_in_field('_hidden')(is_hidden) - - @cached_in_field('_short_html') - def short_html(self): - return render_to_string( - 'catalogue/book_list/chunk.html', {'chunk': self}) - - def touch(self): - update = { - "_changed": self.is_changed(), - "_hidden": self.is_hidden(), - "_short_html": None, - } - Chunk.objects.filter(pk=self.pk).update(**update) - refresh_instance(self) - - def refresh(self): - """This should be done offline.""" - self.changed - self.hidden - self.short_html diff --git a/apps/catalogue/models/document.py b/apps/catalogue/models/document.py new file mode 100755 index 00000000..aedbb687 --- /dev/null +++ b/apps/catalogue/models/document.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# +# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +from __future__ import unicode_literals + +from datetime import date +from django.conf import settings +from django.db import models +from django.template.loader import render_to_string +from django.utils.translation import ugettext_lazy as _ +from dvcs.models import Ref +from organizations.models import Organization +from catalogue.constants import STAGES + + +class Document(Ref): + """ An editable chunk of text.""" + + owner_user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True) + owner_organization = models.ForeignKey(Organization, null=True) + stage = models.CharField(_('stage'), max_length=128, blank=True, default=STAGES[0]) + assigned_to = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, related_name='assignments') + deleted = models.BooleanField(default=False) + + # Where to cache searchable stuff from metadata? + # Probably in some kind of search index. + + class Meta: + verbose_name = _('document') + verbose_name_plural = _('documents') + + def short_html(self): + return render_to_string('catalogue/book_list/book.html', {'book': self}) + + def meta(self): + from lxml import etree + # Wrong! should be metadata + d = {} + + data = self.materialize() + data = data.replace(u'\ufeff', '') + # This is bad. The editor shouldn't spew unknown HTML entities. + data = data.replace(u' ', u'\u00a0') + + try: + t = etree.fromstring(data) + except: + return {'title': '<>'} + header = t.find('.//header') + if header is None: + header = etree.fromstring(data).find('.//{http://nowoczesnapolska.org.pl/sst#}header') + d['title'] = getattr(header, 'text', ' ') or ' ' + #print 'meta', d['title'] + + m = t.find('metadata') + if m is None: + m = t.find('{http://nowoczesnapolska.org.pl/sst#}metadata') + if m is not None: + c = m.find('{http://purl.org/dc/elements/1.1/}relation.coverimage.url') + if c is not None: + d['cover_url'] = c.text + c = m.find('{http://purl.org/dc/elements/1.1/}audience') + if c is not None: + d['audience'] = c.text + + return d + + def can_edit(self, user): + if self.owner_user: + return self.owner_user == user + else: + return self.owner_organization.is_member(user) + + def set_stage(self, stage): + self.stage = stage + plan = self.get_plan() + if plan is not None: + self.assigned_to = plan.user + else: + self.assigned_to = None + self.save() + + def get_plan(self): + try: + plan = self.plan_set.get(stage=self.stage) + except: + return None + return plan + + def is_overdue(self): + plan = self.get_plan() + return plan is not None and plan.deadline and plan.deadline < date.today() diff --git a/apps/catalogue/models/listeners.py b/apps/catalogue/models/listeners.py index 532f1e79..91d39ffb 100755 --- a/apps/catalogue/models/listeners.py +++ b/apps/catalogue/models/listeners.py @@ -7,7 +7,6 @@ from django.contrib.auth.models import User from django.db import models from catalogue.models import Book, Chunk from catalogue.signals import post_publish -from dvcs.signals import post_publishable def book_changed(sender, instance, created, **kwargs): @@ -40,12 +39,6 @@ def publish_listener(sender, *args, **kwargs): post_publish.connect(publish_listener) -def publishable_listener(sender, *args, **kwargs): - sender.tree.touch() - sender.tree.book.touch() -post_publishable.connect(publishable_listener) - - def listener_create(sender, instance, created, **kwargs): if created: instance.chunk_set.create(number=1, slug='1') diff --git a/apps/catalogue/models/plan.py b/apps/catalogue/models/plan.py new file mode 100644 index 00000000..ff5cd168 --- /dev/null +++ b/apps/catalogue/models/plan.py @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- +# +# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +from django.conf import settings +from django.db import models +from catalogue.models import Document + +class Plan(models.Model): + document = models.ForeignKey(Document) + stage = models.CharField(max_length=128) + user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True) + deadline = models.DateField(null=True, blank=True) diff --git a/apps/catalogue/models/project.py b/apps/catalogue/models/project.py deleted file mode 100755 index f9d7483f..00000000 --- a/apps/catalogue/models/project.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- 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 = u'poziom edukacyjny' - verbose_name_plural = u'poziomy edukacyjne' - - def __unicode__(self): - return self.name diff --git a/apps/catalogue/models/publish_log.py b/apps/catalogue/models/publish_log.py index f422e377..cbbcf9ae 100755 --- a/apps/catalogue/models/publish_log.py +++ b/apps/catalogue/models/publish_log.py @@ -1,39 +1,23 @@ # -*- coding: utf-8 -*- # -# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later. +# This file is part of MIL/PEER, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from django.contrib.auth.models import User +from django.conf import settings from django.db import models from django.utils.translation import ugettext_lazy as _ -from catalogue.models import Chunk +from dvcs.models import Revision -class BookPublishRecord(models.Model): - """ - A record left after publishing a Book. - """ +class PublishRecord(models.Model): + """A record left after publishing a Document.""" - book = models.ForeignKey('Book', verbose_name=_('book'), related_name='publish_log') + document = models.ForeignKey('Document', verbose_name=_('document'), related_name='publish_log') + revision = models.ForeignKey(Revision, verbose_name=_('revision'), related_name='publish_log') timestamp = models.DateTimeField(_('time'), auto_now_add=True) - user = models.ForeignKey(User, verbose_name=_('user')) + user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user')) class Meta: - app_label = 'catalogue' ordering = ['-timestamp'] verbose_name = _('book publish record') verbose_name = _('book publish records') - - -class ChunkPublishRecord(models.Model): - """ - BookPublishRecord details for each Chunk. - """ - - book_record = models.ForeignKey(BookPublishRecord, verbose_name=_('book publish record')) - change = models.ForeignKey(Chunk.change_model, related_name='publish_log', verbose_name=_('change')) - - class Meta: - app_label = 'catalogue' - verbose_name = _('chunk publish record') - verbose_name = _('chunk publish records') diff --git a/apps/catalogue/templates/catalogue/base.html b/apps/catalogue/templates/catalogue/base.html index 62345762..41476e94 100644 --- a/apps/catalogue/templates/catalogue/base.html +++ b/apps/catalogue/templates/catalogue/base.html @@ -1,51 +1,79 @@ -{% load compressed i18n %} +{% load i18n %} {% load catalogue %} +{% load javascript stylesheet from pipeline %} +{% load static from staticfiles %} - {% compressed_css 'catalogue' %} - {% block title %}{% trans "Platforma Redakcyjna" %}{% endblock title %} + + + {% stylesheet 'catalogue' %} + + {% block title %}MIL/PEER{% endblock title %} {% block add_css %}{% endblock %} + -
- - - +
{% block content %} -
- {% block leftcolumn %} - {% endblock leftcolumn %} + +
+
+ +{% block inner_content %} +{% endblock %} +
-
- {% block rightcolumn %} - {% endblock rightcolumn %}
+ {% endblock content %}
- -{% compressed_js 'catalogue' %} + + +{% javascript 'catalogue' %} {% block add_js %}{% endblock %} + + + {% block extrabody %} {% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_delete.html b/apps/catalogue/templates/catalogue/book_delete.html new file mode 100644 index 00000000..a32c3446 --- /dev/null +++ b/apps/catalogue/templates/catalogue/book_delete.html @@ -0,0 +1,21 @@ +{% extends "catalogue/base.html" %} +{% load i18n %} + +{% block inner_content %} + {% trans "My resources" %} / + {% if doc.owner_organization %} + {{ doc.owner_organization }} + {% else %} + {{ doc.owner_user.first_name }} {{ doc.owner_user.last_name }} + {% endif %} / +

{{ doc.meta.title }}

+ +

{% trans "Really delete the resource?" %}

+ +
+ {% csrf_token %} + + {% trans "Cancel" %} +
+ +{% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_detail.html b/apps/catalogue/templates/catalogue/book_detail.html index eea6a6c7..1bdbad92 100755 --- a/apps/catalogue/templates/catalogue/book_detail.html +++ b/apps/catalogue/templates/catalogue/book_detail.html @@ -1,10 +1,21 @@ {% extends "catalogue/base.html" %} -{% load book_list comments i18n %} +{% load book_list i18n %} -{% block content %} +{% block inner_content %} -

{{ book.title }}

+

{{ book.title }}

+ + +{% if tab == 'plan' %} + + + +{% endif %} + +{% comment %} {% if editable %}
{% csrf_token %}{% endif %} @@ -27,7 +38,7 @@
-

{% trans "Chunks" %}

+

{% trans "Edit" %}

{% for chunk in book %} @@ -38,7 +49,6 @@ -
@@ -93,14 +103,6 @@
+{% endcomment %} -
-

{% trans "Comments" %}

- - {% render_comment_list for book %} - {% with book.get_absolute_url as next %} - {% render_comment_form for book %} - {% endwith %} -
- -{% endblock content %} +{% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_list/book.html b/apps/catalogue/templates/catalogue/book_list/book.html index 3ad8a65a..fa6a14a0 100755 --- a/apps/catalogue/templates/catalogue/book_list/book.html +++ b/apps/catalogue/templates/catalogue/book_list/book.html @@ -1,28 +1,30 @@ {% load i18n %} -{% if book.single %} - {% with book.0 as chunk %} - - - - - - + + + + + + - {% endwith %} -{% else %} - - - - - - - - -{% endif %} + + + diff --git a/apps/catalogue/templates/catalogue/book_list/book_list.html b/apps/catalogue/templates/catalogue/book_list/book_list.html index ded59227..97f0a59c 100755 --- a/apps/catalogue/templates/catalogue/book_list/book_list.html +++ b/apps/catalogue/templates/catalogue/book_list/book_list.html @@ -1,98 +1,30 @@ {% load i18n %} {% load pagination_tags %} +{% load document_short_html from document_list %} - - - - -{% if not viewed_user %} - -{% endif %} - - - - - - -
- {{ book.title }}{% if chunk.stage %} - {{ chunk.stage }} - {% else %}– - {% endif %}{% if chunk.user %}{{ chunk.user.first_name }} {{ chunk.user.last_name }}{% endif %}{{ book.project.name }}Materiały{{ book.meta.title }} + {% if book.owner_user %} + {{ book.owner_user.first_name }} {{ book.owner_user.last_name }} + {% else %} + {{ book.owner_organization }} + {% endif %} + {% if am_owner %} + ({% trans "change" %}) + {% endif %} + {{ book.stage|default:"–" }}{% if book.assigned_to %}{{ book.assigned_to.first_name }} {{ book.assigned_to.last_name }}{% endif %}{{ book.get_plan.deadline|default:"–" }} + {% if am_owner %} + + {% endif %} +
{{ book.title }}{{ book.project.name }}
- - - - - - {% if not viewed_user %} - - {% endif %} - - - - - - - {% with cnt=books|length %} +
-
- -
-
{% autopaginate books 100 %} + + + + + + + + - {% for item in books %} - {% with item.book as book %} - {{ book.short_html|safe }} - {% if not book.single %} - {% for chunk in item.chunks %} - {{ chunk.short_html|safe }} - {% endfor %} - {% endif %} - {% endwith %} + {% for doc in books %} + {% document_short_html doc %} {% endfor %} + - {% endwith %}
{% trans "Title" %}{% trans "Owner" %}{% trans "Stage" %}{% trans "Assigned to" %}{% trans "Deadline" %}
{% paginate %} - {% blocktrans count c=cnt %}{{c}} module{% plural %}{{c}} modules{% endblocktrans %}
{% if not books %} -

Nie znaleziono modułów.

+

{% trans "No resources found." %}

{% endif %} - - + + {% for org in request.user.membership_set.all %} + + {% endfor %} + + + + + +{% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_schedule.html b/apps/catalogue/templates/catalogue/book_schedule.html new file mode 100644 index 00000000..79fe1b48 --- /dev/null +++ b/apps/catalogue/templates/catalogue/book_schedule.html @@ -0,0 +1,80 @@ +{% extends "catalogue/base.html" %} +{% load i18n %} + +{% block inner_content %} + + +{% trans "Edit" %} +{% trans "Create another version" %} + +{% trans "My resources" %} / +{% if book.owner_organization %} + {{ book.owner_organization }} +{% else %} + {{ book.owner_user.first_name }} {{ book.owner_user.last_name }} +{% endif %} / +

{{ book.meta.title }}

+ + + + +
+ + + + + + + + {% for i, sch, data in schedule %} + + + + + + {% endfor %} + + + + + + + + + + +
{% trans "Stage" %}{% trans "Person" %}{% trans "Deadline" %}
{{ sch }} + {% if people|length > 1 %} + + {% else %} + {{ people.0.first_name }} {{ people.0.last_name }} + {% endif %} +
{% trans "Current stage" %} +
+{% csrf_token %} +
+ + +{% endblock %} diff --git a/apps/catalogue/templates/catalogue/book_text.html b/apps/catalogue/templates/catalogue/book_text.html index b9cc2f0c..bd54ea94 100644 --- a/apps/catalogue/templates/catalogue/book_text.html +++ b/apps/catalogue/templates/catalogue/book_text.html @@ -1,28 +1,178 @@ -{% load i18n compressed %} - - - - - {% trans "Redakcja" %} :: {{ book.title }} - {% compressed_css 'book' %} - - {% compressed_js 'book' %} - - -