diff --git a/atlas/admin.py b/atlas/admin.py index f91658a5..7aa8871c 100755 --- a/atlas/admin.py +++ b/atlas/admin.py @@ -9,7 +9,7 @@ from .models import ( Finding, SeriesFinding, Structure, - PathalogicalProcess, + PathologicalProcess, Presentation, ) @@ -35,13 +35,14 @@ admin.site.register(Finding) admin.site.register(Structure) admin.site.register(SeriesFinding) admin.site.register(Differential) -admin.site.register(PathalogicalProcess) +admin.site.register(PathologicalProcess) admin.site.register(Presentation) class DifferentialInline(admin.TabularInline): model = Differential + class AtlasAdminForm(ModelForm): class Meta: model = Case @@ -62,8 +63,8 @@ class AtlasAdminForm(ModelForm): # "normal": RadioSelect( # choices=[(True, 'Yes'), # (False, 'No')]) - "history": TinyMCE(attrs={"cols": 80, "rows": 30}), - "discussion": TinyMCE(attrs={"cols": 80, "rows": 30}), + "history": TinyMCE(attrs={"cols": 80, "rows": 30}), + "discussion": TinyMCE(attrs={"cols": 80, "rows": 30}), } @@ -74,10 +75,7 @@ class AtlasAdmin(VersionAdmin): save_as = True view_on_site = True - inlines = ( - DifferentialInline, - ) - + inlines = (DifferentialInline,) admin.site.register(Case, AtlasAdmin) diff --git a/atlas/filters.py b/atlas/filters.py index 3e76aaa6..af59f075 100755 --- a/atlas/filters.py +++ b/atlas/filters.py @@ -1,6 +1,15 @@ import django_filters -from .models import Case, Condition, Finding, PathalogicalProcess, Presentation, Series, Structure, Subspecialty +from .models import ( + Case, + Condition, + Finding, + PathologicalProcess, + Presentation, + Series, + Structure, + Subspecialty, +) from django.contrib.auth.models import User @@ -23,13 +32,18 @@ class CaseFilter(django_filters.FilterSet): differential_case = django_filters.ModelMultipleChoiceFilter( label="Differential", field_name="differentialcase__condition", - #to_field_name="differential", + # to_field_name="differential", queryset=Condition.objects.all(), ) class Meta: model = Case - fields = ("created_date", "open_access", "author", "differential_case") # "site", + fields = ( + "created_date", + "open_access", + "author", + "differential_case", + ) # "site", def __init__( self, @@ -135,6 +149,7 @@ class StructureFilter(django_filters.FilterSet): ) pass + class PresentationFilter(django_filters.FilterSet): class Meta: model = Presentation @@ -157,7 +172,7 @@ class PresentationFilter(django_filters.FilterSet): class PathologicalProcessFilter(django_filters.FilterSet): class Meta: - model = PathalogicalProcess + model = PathologicalProcess fields = ("name",) def __init__( @@ -174,6 +189,7 @@ class PathologicalProcessFilter(django_filters.FilterSet): ) pass + class SubspecialtyFilter(django_filters.FilterSet): class Meta: model = Subspecialty diff --git a/atlas/migrations/0021_rename_pathalogicalprocess_pathologicalprocess.py b/atlas/migrations/0021_rename_pathalogicalprocess_pathologicalprocess.py new file mode 100644 index 00000000..5a825540 --- /dev/null +++ b/atlas/migrations/0021_rename_pathalogicalprocess_pathologicalprocess.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.8 on 2021-12-07 15:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('atlas', '0020_rename_pathalogical_process_case_pathological_process'), + ] + + operations = [ + migrations.RenameModel( + old_name='PathalogicalProcess', + new_name='PathologicalProcess', + ), + ] diff --git a/atlas/models.py b/atlas/models.py index 990117e0..4adf92a2 100644 --- a/atlas/models.py +++ b/atlas/models.py @@ -163,7 +163,7 @@ class Subspecialty(models.Model): return format_html("{}", self.get_absolute_url(), self.name) -class PathalogicalProcess(models.Model): +class PathologicalProcess(models.Model): name = models.CharField(max_length=255) def __str__(self) -> str: @@ -230,7 +230,7 @@ class Case(models.Model): presentation = models.ManyToManyField(Presentation, blank=True) - pathological_process = models.ManyToManyField(PathalogicalProcess, blank=True) + pathological_process = models.ManyToManyField(PathologicalProcess, blank=True) differential = models.ManyToManyField( Condition, through=Differential, related_name="casedifferential" diff --git a/atlas/tables.py b/atlas/tables.py index 2865e2fd..9044649e 100755 --- a/atlas/tables.py +++ b/atlas/tables.py @@ -4,7 +4,7 @@ from django_tables2.utils import A from .models import ( Case, Condition, - PathalogicalProcess, + PathologicalProcess, Presentation, Series, Structure, @@ -244,12 +244,12 @@ class PresentationTable(tables.Table): verbose_name="Presentation", ) - #edit = tables.LinkColumn( + # edit = tables.LinkColumn( # "atlas:presentation_update", text="Edit", args=[A("pk")], orderable=False - #) - #delete = tables.LinkColumn( + # ) + # delete = tables.LinkColumn( # "atlas:presentation_delete", text="Delete", args=[A("pk")], orderable=False - #) + # ) selection = tables.CheckBoxColumn(accessor="pk", orderable=False) subspecialty = tables.ManyToManyColumn(verbose_name="Subspecialty") @@ -267,32 +267,33 @@ class PathologicalProcessTable(tables.Table): verbose_name="PathologicalProcess", ) - #edit = tables.LinkColumn( + # edit = tables.LinkColumn( # "atlas:pathological_process_update", text="Edit", args=[A("pk")], orderable=False - #) - #delete = tables.LinkColumn( + # ) + # delete = tables.LinkColumn( # "atlas:pathological_process_delete", text="Delete", args=[A("pk")], orderable=False - #) + # ) selection = tables.CheckBoxColumn(accessor="pk", orderable=False) class Meta: - model = PathalogicalProcess + model = PathologicalProcess template_name = "django_tables2/bootstrap4.html" fields = ("name",) sequence = ("name",) + class SubspecialtyTable(tables.Table): name = tables.Column( linkify=("atlas:subspecialty_detail", {"pk": tables.A("pk")}), verbose_name="Subspecialty", ) - #edit = tables.LinkColumn( + # edit = tables.LinkColumn( # "atlas:subspecialty_update", text="Edit", args=[A("pk")], orderable=False - #) - #delete = tables.LinkColumn( + # ) + # delete = tables.LinkColumn( # "atlas:subspecialty_delete", text="Delete", args=[A("pk")], orderable=False - #) + # ) selection = tables.CheckBoxColumn(accessor="pk", orderable=False) class Meta: diff --git a/atlas/views.py b/atlas/views.py index 023963cb..bb75af04 100755 --- a/atlas/views.py +++ b/atlas/views.py @@ -40,7 +40,7 @@ from .forms import ( from .models import ( Case, Condition, - PathalogicalProcess, + PathologicalProcess, Presentation, Series, Examination, @@ -210,7 +210,7 @@ def presentation_detail(request, pk): @login_required @user_is_atlas_checker def pathological_process_detail(request, pk): - pathological_process = get_object_or_404(PathalogicalProcess, pk=pk) + pathological_process = get_object_or_404(PathologicalProcess, pk=pk) # logging.debug(atlas.subspecialty.first().name.all()) return render( @@ -685,7 +685,7 @@ class PresentationView(LoginRequiredMixin, SingleTableMixin, FilterView): class PathologicalProcessView(LoginRequiredMixin, SingleTableMixin, FilterView): - model = PathalogicalProcess + model = PathologicalProcess table_class = PathologicalProcessTable template_name = "atlas/view.html"