diff --git a/.gitignore b/.gitignore index 8ea14f1..ab772bf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ __pycache__/ *.py[cod] *$py.class +.idea # C extensions *.so diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b8..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/image_markuper.iml b/.idea/image_markuper.iml deleted file mode 100644 index 3332037..0000000 --- a/.idea/image_markuper.iml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index a970995..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 90931fa..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/.idea/runConfigurations/docker_compose_up_django.xml b/.idea/runConfigurations/docker_compose_up_django.xml deleted file mode 100644 index 2e3e177..0000000 --- a/.idea/runConfigurations/docker_compose_up_django.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - diff --git a/.idea/runConfigurations/docker_compose_up_docs.xml b/.idea/runConfigurations/docker_compose_up_docs.xml deleted file mode 100644 index 0f77b28..0000000 --- a/.idea/runConfigurations/docker_compose_up_docs.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - diff --git a/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml b/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml deleted file mode 100644 index 7950ca4..0000000 --- a/.idea/runConfigurations/merge_production_dotenvs_in_dotenv.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - diff --git a/.idea/runConfigurations/migrate.xml b/.idea/runConfigurations/migrate.xml deleted file mode 100644 index 058c221..0000000 --- a/.idea/runConfigurations/migrate.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - diff --git a/.idea/runConfigurations/pytest___.xml b/.idea/runConfigurations/pytest___.xml deleted file mode 100644 index a452729..0000000 --- a/.idea/runConfigurations/pytest___.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/pytest__users.xml b/.idea/runConfigurations/pytest__users.xml deleted file mode 100644 index fb28717..0000000 --- a/.idea/runConfigurations/pytest__users.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations/runserver.xml b/.idea/runConfigurations/runserver.xml deleted file mode 100644 index 144b42c..0000000 --- a/.idea/runConfigurations/runserver.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/.idea/runConfigurations/runserver_plus.xml b/.idea/runConfigurations/runserver_plus.xml deleted file mode 100644 index e0ed54d..0000000 --- a/.idea/runConfigurations/runserver_plus.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 5ace414..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/.idea/webResources.xml b/.idea/webResources.xml deleted file mode 100644 index 204f8bc..0000000 --- a/.idea/webResources.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/image_markuper/dicom/admin.py b/image_markuper/dicom/admin.py index e69de29..ac2c093 100644 --- a/image_markuper/dicom/admin.py +++ b/image_markuper/dicom/admin.py @@ -0,0 +1,6 @@ +from dicom.models import Circle, Dicom, Polygon +from django.contrib import admin + +admin.site.register(Dicom) +admin.site.register(Circle) +admin.site.register(Polygon) diff --git a/image_markuper/dicom/api/serializers.py b/image_markuper/dicom/api/serializers.py index 9966824..d24d5a3 100644 --- a/image_markuper/dicom/api/serializers.py +++ b/image_markuper/dicom/api/serializers.py @@ -27,7 +27,7 @@ class ListDicomSerializer(serializers.ModelSerializer): class Meta: model = Dicom - fields = ["file", "uploaded", "url"] + fields = ["file", "uploaded", "pathology_type", "url"] def create(self, validated_data): return Dicom.objects.create(**validated_data, user=self.context["request"].user) @@ -49,7 +49,7 @@ class DicomSerializer(serializers.ModelSerializer): class Meta: model = Dicom - fields = ["file", "uploaded", "shapes"] + fields = ["file", "uploaded", "pathology_type", "shapes"] class PolygonSerializer(serializers.ModelSerializer): diff --git a/image_markuper/dicom/models/base.py b/image_markuper/dicom/models/base.py index 315d5b3..f10a5d0 100644 --- a/image_markuper/dicom/models/base.py +++ b/image_markuper/dicom/models/base.py @@ -1,16 +1,26 @@ from django.contrib.auth import get_user_model from django.db import models +from django.urls import reverse from utils.files import media_upload_path User = get_user_model() class Dicom(models.Model): + class PathologyType(models.IntegerChoices): + no_pathology = 0, "Без патологий" + covid_pathology = 1, "Covid" + user = models.ForeignKey(User, related_name="files", on_delete=models.CASCADE) slug = models.SlugField() file = models.FileField(upload_to=media_upload_path) uploaded = models.DateTimeField(auto_now_add=True) + pathology_type = models.IntegerField(choices=PathologyType.choices) + def __str__(self): return self.file.name + + def get_absolute_url(self): + return reverse("get_update_delete_dicom", kwargs={"slug": self.slug}) diff --git a/setup.cfg b/setup.cfg index 48dc6a9..4d6127e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,7 @@ [flake8] max-line-length = 120 exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs,node_modules,venv +per-file-ignores = __init__.py:F401 [pycodestyle] max-line-length = 120