Commit bf10c65b2c58e2ef4b8b90f5b4f178803e1e5857

Authored by Bartłomiej Nitoń
1 parent bf3e6b03

Remove BookWithMultipleAuthors.

collector/storage/admin.py
... ... @@ -2,8 +2,8 @@ from django.contrib import admin
2 2  
3 3 from admin_numeric_filter.admin import RangeNumericFilter
4 4  
5   -from storage.models import Chunk, Document, Keyword, Metadata, Participant, Annotation, Magazine, \
6   - Book, BookWithMultipleAuthors, Website, Article, Chapter, WebPage
  5 +from storage.models import Chunk, Document, Keyword, Metadata, Participant, Annotation, Magazine, Book, \
  6 + Website, Article, Chapter, WebPage
7 7  
8 8  
9 9 class ChunkInline(admin.StackedInline):
... ... @@ -56,7 +56,6 @@ admin.site.register(Chunk, ChunkAdmin)
56 56 admin.site.register(Document, DocumentAdmin)
57 57 admin.site.register(Magazine)
58 58 admin.site.register(Book)
59   -admin.site.register(BookWithMultipleAuthors)
60 59 admin.site.register(Website)
61 60 admin.site.register(Article)
62 61 admin.site.register(Chapter)
... ...
collector/storage/forms.py
... ... @@ -3,8 +3,7 @@ import re
3 3 from django.forms import ChoiceField, ModelChoiceField, ModelForm, Textarea, CharField, Form
4 4 from django import forms
5 5  
6   -from .models import Chunk, Document, Participant, Metadata, Keyword, Magazine, Book, BookWithMultipleAuthors, Website, \
7   - WebPage
  6 +from .models import Chunk, Document, Participant, Metadata, Keyword, Magazine, Book, Website, WebPage
8 7 from .utils import get_doc_with_type
9 8 from projects.ppc.models import Utterance
10 9 from collector import settings
... ... @@ -297,17 +296,6 @@ DOC_TYPE_DETAILS_FIELDS = {
297 296 'original_lang': 'Język oryginału'
298 297 }
299 298 },
300   - BookWithMultipleAuthors: {
301   - 'fields': ['title', 'publication_date', 'publication_place', 'publisher', 'channel', 'original_lang'],
302   - 'labels': {
303   - 'title': 'Tytuł',
304   - 'publication_date': 'Data publikacji',
305   - 'publication_place': 'Miejsce publikacji',
306   - 'publisher': 'Wydawca',
307   - 'channel': 'Kanał',
308   - 'original_lang': 'Język oryginału'
309   - }
310   - },
311 299 Website: {
312 300 'fields': ['title', 'url', 'channel', 'original_lang'],
313 301 'labels': {
... ... @@ -391,30 +379,6 @@ class BookDetailsForm(ModelForm):
391 379 }
392 380  
393 381  
394   -class BWMADetailsForm(ModelForm):
395   - def __init__(self, *args, **kwargs):
396   - super(BWMADetailsForm, self).__init__(*args, **kwargs)
397   - self.fields['title'].widget = Textarea(attrs={'rows': 1})
398   -
399   - def save(self, commit=True):
400   - bwma = super(BWMADetailsForm, self).save(commit)
401   - bwma.changed = True
402   - bwma.save()
403   - return bwma
404   -
405   - class Meta:
406   - model = BookWithMultipleAuthors
407   - fields = ['title', 'publication_date', 'publication_place', 'publisher', 'channel', 'original_lang']
408   - labels = {
409   - 'title': 'Tytuł',
410   - 'publication_date': 'Data publikacji',
411   - 'publication_place': 'Miejsce publikacji',
412   - 'publisher': 'Wydawca',
413   - 'channel': 'Kanał',
414   - 'original_lang': 'Język oryginału'
415   - }
416   -
417   -
418 382 class WebsiteDetailsForm(ModelForm):
419 383 def __init__(self, *args, **kwargs):
420 384 super(WebsiteDetailsForm, self).__init__(*args, **kwargs)
... ...
collector/storage/models.py
... ... @@ -169,20 +169,6 @@ class Magazine(Document):
169 169 return 'czasopismo'
170 170  
171 171  
172   -class BookWithMultipleAuthors(Document):
173   - publisher = models.CharField(max_length=100, null=True)
174   -
175   - def check_details_filling(self):
176   - if self.title == '' or self.publication_date is None or self.publication_place == '' or self.publisher == '' \
177   - or self.original_lang == '':
178   - return False
179   - return True
180   -
181   - @staticmethod
182   - def get_doc_type_display():
183   - return 'książka o wielu autorach'
184   -
185   -
186 172 class Book(Document):
187 173 publisher = models.CharField(max_length=100, null=True)
188 174  
... ...
collector/storage/templates/storage/annotation.html
... ... @@ -224,8 +224,6 @@
224 224 {% endif %}
225 225 {% if document|isinst:"storage.models.Magazine" %}
226 226 <th>Numer</th>
227   - {% elif document|isinst:"storage.models.BookWithMultipleAuthors" %}
228   - <th>Wydawca</th>
229 227 {% elif document|isinst:"storage.models.Book" %}
230 228 <th>Wydawca</th>
231 229 {% endif %}
... ... @@ -238,9 +236,6 @@
238 236 {% if document|isinst:"storage.models.Magazine" %}
239 237 <i class="edit-doc-details material-icons button edit" data-id="{% url 'edit_magazine_details' document.pk %}"
240 238 title="Edytuj">edit</i>
241   - {% elif document|isinst:"storage.models.BookWithMultipleAuthors" %}
242   - <i class="edit-doc-details material-icons button edit" data-id="{% url 'edit_bwma_details' document.pk %}"
243   - title="Edytuj">edit</i>
244 239 {% elif document|isinst:"storage.models.Book" %}
245 240 <i class="edit-doc-details material-icons button edit" data-id="{% url 'edit_book_details' document.pk %}"
246 241 title="Edytuj">edit</i>
... ... @@ -267,8 +262,6 @@
267 262 {% endif %}
268 263 {% if document|isinst:"storage.models.Magazine" %}
269 264 <td>{{ document.number|default_if_none:'' }}</td>
270   - {% elif document|isinst:"storage.models.BookWithMultipleAuthors" %}
271   - <td>{{ document.publisher|default_if_none:'' }}</td>
272 265 {% elif document|isinst:"storage.models.Book" %}
273 266 <td>{{ document.publisher|default_if_none:'' }}</td>
274 267 {% endif %}
... ...
collector/storage/templates/storage/review.html
... ... @@ -166,8 +166,6 @@
166 166 {% endif %}
167 167 {% if document|isinst:"storage.models.Magazine" %}
168 168 <th>Numer</th>
169   - {% elif document|isinst:"storage.models.BookWithMultipleAuthors" %}
170   - <th>Wydawca</th>
171 169 {% elif document|isinst:"storage.models.Book" %}
172 170 <th>Wydawca</th>
173 171 {% endif %}
... ... @@ -189,8 +187,6 @@
189 187 {% endif %}
190 188 {% if document|isinst:"storage.models.Magazine" %}
191 189 <td>{{ document.number }}</td>
192   - {% elif document|isinst:"storage.models.BookWithMultipleAuthors" %}
193   - <td>{{ document.publisher }}</td>
194 190 {% elif document|isinst:"storage.models.Book" %}
195 191 <td>{{ document.publisher }}</td>
196 192 {% endif %}
... ...
collector/storage/urls.py
... ... @@ -12,8 +12,6 @@ urlpatterns = [
12 12 path('document/edit-details/<int:pk>', login_required(views.DocDetailsEditView.as_view()), name='edit_doc_details'),
13 13 path('document/edit-magazine-details/<int:pk>', login_required(views.MagazineDetailsEditView.as_view()),
14 14 name='edit_magazine_details'),
15   - path('document/edit-bwma-details/<int:pk>', login_required(views.BWMADetailsEditView.as_view()),
16   - name='edit_bwma_details'),
17 15 path('document/edit-book-details/<int:pk>', login_required(views.BookDetailsEditView.as_view()),
18 16 name='edit_book_details'),
19 17 path('document/edit-website-details/<int:pk>', login_required(views.WebsiteDetailsEditView.as_view()),
... ...
collector/storage/utils.py
1   -from .models import Document, Magazine, Book, BookWithMultipleAuthors, Website, Article, Chapter, WebPage
  1 +from .models import Document, Magazine, Book, Website, Article, Chapter, WebPage
2 2  
3   -DOCUMENT_TYPES_CLASSES = Document, Magazine, Book, BookWithMultipleAuthors, Website
  3 +DOCUMENT_TYPES_CLASSES = Document, Magazine, Book, Website
4 4  
5 5 SUBDOCUMENT_TYPES = { # first subdocument type in tuples are the default ones for this type of the document
6 6 Document: (Document,),
7 7 Magazine: (Article,),
8 8 Book: (Chapter,),
9   - BookWithMultipleAuthors: (Chapter,),
10 9 Website: (WebPage,)
11 10 }
12 11  
... ...
collector/storage/views.py
... ... @@ -23,9 +23,9 @@ from functools import partial, wraps
23 23  
24 24 from .forms import ChunkForm, ParticipantForm, SubchunkForm, MetadataForm, KeywordForm, DocSplitForm, ChunkMoveForm, \
25 25 SubDocDetailsForm, WebPageDetailsForm, AuthorForm, ChunkMergeForm, ChunkSplitForm, DocTypeForm, DocDetailsForm, \
26   - MagazineDetailsForm, BookDetailsForm, BWMADetailsForm, WebsiteDetailsForm
27   -from .models import Chunk, Document, Participant, Metadata, Keyword, Annotation, Magazine, Book, \
28   - BookWithMultipleAuthors, Website, Article, Chapter, WebPage
  26 + MagazineDetailsForm, BookDetailsForm, WebsiteDetailsForm
  27 +from .models import Chunk, Document, Participant, Metadata, Keyword, Annotation, Magazine, Book, Website, Article, \
  28 + Chapter, WebPage
29 29 from .utils import get_remaining_doc_types_tuple, get_remaining_subdoc_types_tuple, get_doc_with_type, SUBDOCUMENT_TYPES
30 30 from projects.ppc.models import Utterance
31 31 from pipeline.models import ProcessingStatus
... ... @@ -777,11 +777,6 @@ class BookDetailsEditView(DocDetailsEditView):
777 777 form_class = BookDetailsForm
778 778  
779 779  
780   -class BWMADetailsEditView(DocDetailsEditView):
781   - model = BookWithMultipleAuthors
782   - form_class = BWMADetailsForm
783   -
784   -
785 780 class WebsiteDetailsEditView(DocDetailsEditView):
786 781 model = Website
787 782 form_class = WebsiteDetailsForm
... ...