Commit 46b15167d9bffda17e629a74e3e41d38aae9b32d

Authored by Marcel Kawski
1 parent 920a74fa

Add some models for document types

Showing 1 changed file with 41 additions and 0 deletions
collector/storage/models.py
... ... @@ -153,6 +153,47 @@ class Document(models.Model):
153 153 return f'{self.name}-{self.id}'
154 154  
155 155  
  156 +class Magazine(Document):
  157 + number2 = models.CharField(max_length=50, null=True)
  158 +
  159 + def check_details_filling(self):
  160 + if self.title == '' or self.publication_date is None or self.publication_place == '' or self.number == '' \
  161 + or self.original_lang == '':
  162 + return False
  163 + return True
  164 +
  165 + @staticmethod
  166 + def get_doc_type_display():
  167 + return 'czasopismo'
  168 +
  169 +
  170 +class BookWithMultipleAuthors(Document):
  171 + publisher2 = models.CharField(max_length=100, null=True)
  172 +
  173 + def check_details_filling(self):
  174 + if self.title == '' or self.publication_date is None or self.publication_place == '' or self.publisher == '' \
  175 + or self.original_lang == '':
  176 + return False
  177 + return True
  178 +
  179 + @staticmethod
  180 + def get_doc_type_display():
  181 + return 'książka o wielu autorach'
  182 +
  183 +
  184 +class Article(Document):
  185 + @staticmethod
  186 + def get_doc_type_display():
  187 + return 'artykuł'
  188 +
  189 +
  190 +class Chapter(Document):
  191 + @staticmethod
  192 + def get_doc_type_display():
  193 + return 'rozdział'
  194 +
  195 +
  196 +
156 197 class Chunk(models.Model):
157 198 document = models.ForeignKey(Document, related_name='chunks', on_delete=models.CASCADE)
158 199 sequence = models.PositiveIntegerField()
... ...