From eb43f17882f370249166c2da11df4c747b9f7da9 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 18 Jan 2021 20:59:23 +0900 Subject: [PATCH] Remove image property from Project models and serializers, fix #713 --- app/api/models.py | 21 --------------------- app/api/serializers.py | 8 ++++---- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/app/api/models.py b/app/api/models.py index bdb18c16..119a4697 100644 --- a/app/api/models.py +++ b/app/api/models.py @@ -6,7 +6,6 @@ from django.db.models.signals import post_save, pre_delete from django.urls import reverse from django.conf import settings from django.contrib.auth.models import User -from django.contrib.staticfiles.storage import staticfiles_storage from django.core.exceptions import ValidationError from polymorphic.models import PolymorphicModel @@ -39,10 +38,6 @@ class Project(PolymorphicModel): def get_absolute_url(self): return reverse('upload', args=[self.id]) - @property - def image(self): - raise NotImplementedError() - def get_bundle_name(self): raise NotImplementedError() @@ -67,10 +62,6 @@ class Project(PolymorphicModel): class TextClassificationProject(Project): - @property - def image(self): - return staticfiles_storage.url('assets/images/cats/text_classification.jpg') - def get_bundle_name(self): return 'document_classification' @@ -94,10 +85,6 @@ class TextClassificationProject(Project): class SequenceLabelingProject(Project): - @property - def image(self): - return staticfiles_storage.url('assets/images/cats/sequence_labeling.jpg') - def get_bundle_name(self): return 'sequence_labeling' @@ -121,10 +108,6 @@ class SequenceLabelingProject(Project): class Seq2seqProject(Project): - @property - def image(self): - return staticfiles_storage.url('assets/images/cats/seq2seq.jpg') - def get_bundle_name(self): return 'seq2seq' @@ -148,10 +131,6 @@ class Seq2seqProject(Project): class Speech2textProject(Project): - @property - def image(self): - return staticfiles_storage.url('images/cats/speech2text.jpg') - def get_bundle_name(self): return 'speech2text' diff --git a/app/api/serializers.py b/app/api/serializers.py index 78444cc1..8c3d1950 100644 --- a/app/api/serializers.py +++ b/app/api/serializers.py @@ -119,9 +119,9 @@ class ProjectSerializer(serializers.ModelSerializer): class Meta: model = Project - fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'image', + fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'updated_at', 'randomize_document_order', 'collaborative_annotation', 'single_class_classification') - read_only_fields = ('image', 'updated_at', 'users', 'current_users_role') + read_only_fields = ('updated_at', 'users', 'current_users_role') class TextClassificationProjectSerializer(ProjectSerializer): @@ -152,9 +152,9 @@ class Speech2textProjectSerializer(ProjectSerializer): class Meta: model = Speech2textProject - fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'image', + fields = ('id', 'name', 'description', 'guideline', 'users', 'current_users_role', 'project_type', 'updated_at', 'randomize_document_order') - read_only_fields = ('image', 'updated_at', 'users', 'current_users_role') + read_only_fields = ('updated_at', 'users', 'current_users_role') class ProjectPolymorphicSerializer(PolymorphicSerializer):