diff --git a/webcentral/doc/01_data/05_technical_standards/norms.xlsx b/webcentral/doc/01_data/05_technical_standards/norms.xlsx new file mode 100644 index 000000000..daea319be Binary files /dev/null and b/webcentral/doc/01_data/05_technical_standards/norms.xlsx differ diff --git a/webcentral/src/Datasets/migrations/0022_alter_dataset_applicationarea_and_more.py b/webcentral/src/Datasets/migrations/0022_alter_dataset_applicationarea_and_more.py new file mode 100644 index 000000000..016fc2ce0 --- /dev/null +++ b/webcentral/src/Datasets/migrations/0022_alter_dataset_applicationarea_and_more.py @@ -0,0 +1,52 @@ +# Generated by Django 5.0.9 on 2024-11-18 12:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("Datasets", "0021_historydataset"), + ( + "project_listing", + "0003_alter_enargus_randdplanningcategory_and_more", + ), + ("tools_over", "0008_alter_tools_technicalstandardsprotocols"), + ] + + operations = [ + migrations.AlterField( + model_name="dataset", + name="applicationArea", + field=models.ManyToManyField( + db_comment="Typical application area in which the dataset is used.", + to="tools_over.applicationarea", + ), + ), + migrations.AlterField( + model_name="dataset", + name="classification", + field=models.ManyToManyField( + db_comment="General type of dataset - Which type or of to which typ belongs the dataset. E.g. framework, programming language, ...", + to="tools_over.classification", + ), + ), + migrations.AlterField( + model_name="dataset", + name="focus", + field=models.ManyToManyField( + db_comment="Focus identifier - Selected focus (Definied by Wissensplattform)", + max_length=200, + to="tools_over.focus", + ), + ), + migrations.AlterField( + model_name="dataset", + name="specificApplication", + field=models.ManyToManyField( + blank=True, + db_comment="Specific use cases - Identification of concrete examples of the use of the item in the construction sector/energy transition (equals project number)", + to="project_listing.subproject", + ), + ), + ] diff --git a/webcentral/src/Datasets/models.py b/webcentral/src/Datasets/models.py index c9f97a3aa..6d5d83f14 100644 --- a/webcentral/src/Datasets/models.py +++ b/webcentral/src/Datasets/models.py @@ -1,7 +1,7 @@ from django.db import models from django.db.models.functions import Now -from tools_over.models import ( +from common.models import ( ApplicationArea, Focus, LifeCyclePhase, @@ -19,19 +19,15 @@ class Dataset(models.Model): name = models.CharField(max_length=200, db_comment="Name of the dataset") applicationArea = models.ManyToManyField( ApplicationArea, - max_length=200, - null=True, db_comment="Typical application area in which the dataset is used.", ) focus = models.ManyToManyField( Focus, max_length=200, - null=True, db_comment="Focus identifier - Selected focus (Definied by Wissensplattform)", ) classification = models.ManyToManyField( Classification, - null=True, db_comment="General type of dataset - Which type or of to which typ belongs the dataset. E.g. framework, programming language, ...", ) lifeCyclePhase = models.ManyToManyField( @@ -161,7 +157,6 @@ class Dataset(models.Model): specificApplication = models.ManyToManyField( Subproject, blank=True, - null=True, db_comment="Specific use cases - Identification of concrete examples of the use of the item in the construction sector/energy transition (equals project number)", ) diff --git a/webcentral/src/TechnicalStandards/data_export.py b/webcentral/src/TechnicalStandards/data_export.py index 0abd0acd9..b973c9b0b 100644 --- a/webcentral/src/TechnicalStandards/data_export.py +++ b/webcentral/src/TechnicalStandards/data_export.py @@ -1,7 +1,7 @@ import pandas as pd from django.db import models -from .models import Protocol +from .models import Norm class DataExport: @@ -10,52 +10,16 @@ class DataExport: SEPARATOR_M2M = ";;" MAPPING_ORM_TO_XLSX = { "name": "name", - # "focus": "focus", - # "classification": "classification", - # "lifeCyclePhase": "lifeCyclePhase", - # "scale": "scale", - # "targetGroup": "targetGroup", - # "alternatives": "alternatives", - # "developmentState": "developmentState", - # "furtherInformation": "furtherInformation", - # "released": "released", - # "provider": "provider", - # "resources": "resources", - # "license": "license", - # "accessibility": "accessibility", - # "programmingLanguages": "programmingLanguages", - # "description": "description", - # "specificApplication": "specificApplication", - # "technicalStandardsNorms": "technicalStandardsNorms", - # "yearOfRelease": "yearOfRelease", - # "usage": "usage", - # "tools": "tools", - "communicationMediumCategory": "communicationMediumCategory", - "supportedTransmissionMediuems": "supportedTransmissionMediuems", - "associatedStandards": "associatedStandards", - "networkTopology": "networkTopology", - "security": "security", - "bandwidth": "bandwidth", - "frequency": "frequency", - "range": "range", - "numberOfConnectedDevices": "numberOfConnectedDevices", - "dataModelArchitecture": "dataModelArchitecture", - "discovery": "discovery", - "multiMaster": "multiMaster", - "packetSize": "packetSize", - "priorities": "priorities", - "price": "price", - "osiLayers": "osiLayers", - "buildingAutomationLayer": "buildingAutomationLayer", - "openSourceStatus": "openSourceStatus", - "licensingFeeRequirement": "licensingFeeRequirement", - # "exampleProject": "exampleProject", - "image": "image", + # "isNorm": "isNorm", + "title": "title", + # "image": "image", "link": "link", + "shortDescription": "shortDescription", + "source": "source", } - DATA_APP_DIR = "18_protocols" - EXPORT_MODEL_OBJ = Protocol + DATA_APP_DIR = "05_technical_standards" + EXPORT_MODEL_OBJ = Norm def __init__(self, filename): """ """ diff --git a/webcentral/src/TechnicalStandards/migrations/0001_initial_squashed_0008_alter_norm_alternatives_alter_norm_name_and_more.py b/webcentral/src/TechnicalStandards/migrations/0001_initial_squashed_0008_alter_norm_alternatives_alter_norm_name_and_more.py new file mode 100644 index 000000000..2f1bfe242 --- /dev/null +++ b/webcentral/src/TechnicalStandards/migrations/0001_initial_squashed_0008_alter_norm_alternatives_alter_norm_name_and_more.py @@ -0,0 +1,308 @@ +# Generated by Django 5.0.9 on 2024-11-18 13:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + replaces = [ + ("TechnicalStandards", "0001_initial"), + ("TechnicalStandards", "0002_delete_protocol"), + ( + "TechnicalStandards", + "0003_norm_accessibility_norm_alternatives_and_more", + ), + ("TechnicalStandards", "0004_remove_norm_link_norm_resources"), + ("TechnicalStandards", "0005_remove_norm_shortdescription_and_more"), + ( + "TechnicalStandards", + "0006_norm_specificapplication_norm_usage_and_more", + ), + ("TechnicalStandards", "0007_remove_norm_isnorm"), + ( + "TechnicalStandards", + "0008_alter_norm_alternatives_alter_norm_name_and_more", + ), + ] + + dependencies = [ + ("common", "0006_license_licensingfeerequirement_de_and_more"), + ( + "project_listing", + "0003_alter_enargus_randdplanningcategory_and_more", + ), + ("tools_over", "0008_alter_tools_technicalstandardsprotocols"), + ] + + operations = [ + migrations.CreateModel( + name="Norm", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "name", + models.CharField( + blank=True, + db_comment="Name of the item", + help_text="name of the norm", + max_length=150, + ), + ), + ( + "name_de", + models.CharField( + blank=True, + db_comment="Name of the item", + help_text="name of the norm", + max_length=150, + null=True, + ), + ), + ( + "name_en", + models.CharField( + blank=True, + db_comment="Name of the item", + help_text="name of the norm", + max_length=150, + null=True, + ), + ), + ( + "title", + models.CharField( + blank=True, + db_comment="full title of the norm", + help_text="title of the norm", + max_length=250, + ), + ), + ( + "title_de", + models.CharField( + blank=True, + db_comment="full title of the norm", + help_text="title of the norm", + max_length=250, + null=True, + ), + ), + ( + "title_en", + models.CharField( + blank=True, + db_comment="full title of the norm", + help_text="title of the norm", + max_length=250, + null=True, + ), + ), + ( + "source", + models.CharField( + blank=True, help_text="source", max_length=100 + ), + ), + ( + "source_de", + models.CharField( + blank=True, + help_text="source", + max_length=100, + null=True, + ), + ), + ( + "source_en", + models.CharField( + blank=True, + help_text="source", + max_length=100, + null=True, + ), + ), + ( + "accessibility", + models.ManyToManyField( + db_comment="Accessibility - How accessible is the dataset?", + to="tools_over.accessibility", + ), + ), + ( + "alternatives", + models.CharField( + blank=True, + db_comment="Alternatives - items with equal or likewise use case.", + help_text="Alternatives - Items with equal or likewise use case.", + max_length=300, + null=True, + ), + ), + ( + "applicationArea", + models.ManyToManyField( + db_comment="Typical application area in which the item is used.", + to="tools_over.applicationarea", + ), + ), + ( + "classification", + models.ManyToManyField( + db_comment="General type of item - Which type or of to which typ belongs the item. E.g. framework, programming language, ...", + to="tools_over.classification", + ), + ), + ( + "developmentState", + models.IntegerField( + blank=True, + choices=[ + (1, "pre-alpha"), + (2, "alpha"), + (3, "beta"), + (4, "release candidate"), + (5, "release"), + ], + db_comment="Level of development - What is the curent development status", + null=True, + ), + ), + ( + "focus", + models.ManyToManyField( + db_comment="Focus identifier - Selected focus (Definied by Wissensplattform)", + max_length=200, + to="tools_over.focus", + ), + ), + ( + "furtherInformation", + models.CharField( + blank=True, + db_comment="Further information - Information of miscellaneous subjects", + max_length=1200, + null=True, + ), + ), + ( + "image", + models.ImageField( + blank=True, + db_comment="File name of image file. Located in media-folder.", + null=True, + upload_to="", + ), + ), + ( + "license", + models.ManyToManyField( + db_comment="under which license was the dataset published and are there any costs associated with using the dataset?", + to="common.license", + ), + ), + ( + "lifeCyclePhase", + models.ManyToManyField( + db_comment="Life cycle phase - In which phase of the product life cycle is the tool used?", + to="tools_over.lifecyclephase", + ), + ), + ( + "programmingLanguages", + models.CharField( + blank=True, + db_comment="Programming languages - Which programming languages are mainly used to implment the item.", + max_length=500, + null=True, + ), + ), + ( + "provider", + models.CharField( + blank=True, + db_comment="Developers/maintainers/provider - Person or organisation responsible for the development of the item.", + max_length=300, + null=True, + ), + ), + ( + "released", + models.BooleanField( + blank=True, + db_comment="Released - Is the publication done?", + null=True, + ), + ), + ( + "scale", + models.ManyToManyField( + db_comment="Spatial scale of the use cases - On what scale is the dataset used?", + to="tools_over.scale", + ), + ), + ( + "targetGroup", + models.ManyToManyField( + db_comment="Target group - Who do you say the digital item is aimed at?", + to="tools_over.targetgroup", + ), + ), + ( + "resources", + models.CharField( + blank=True, + db_comment="Sources of information - sources for further information about the item e.g. git repo, project website, ...", + help_text="link", + max_length=1000, + ), + ), + ( + "description", + models.TextField( + blank=True, + db_comment="Description of the item.", + default=None, + help_text="short description", + max_length=1000, + null=True, + ), + ), + ( + "specificApplication", + models.ManyToManyField( + blank=True, + db_comment="Specific use cases - Identification of concrete examples of the use of the item in the construction sector/energy transition (equals project number)", + to="project_listing.subproject", + ), + ), + ( + "usage", + models.ManyToManyField( + db_comment="Use type - What purpose is the item used for? (Simulation, monitoring, optimization, planning, control advanced control)", + to="tools_over.usage", + ), + ), + ( + "yearOfRelease", + models.CharField( + blank=True, + db_comment="Year of publication - If the item is published, in which year was it released?", + help_text="year of software release (planned or conducted)", + max_length=100, + null=True, + ), + ), + ], + options={ + "abstract": False, + }, + ), + ] diff --git a/webcentral/src/TechnicalStandards/migrations/0003_norm_accessibility_norm_alternatives_and_more.py b/webcentral/src/TechnicalStandards/migrations/0003_norm_accessibility_norm_alternatives_and_more.py new file mode 100644 index 000000000..d0a040049 --- /dev/null +++ b/webcentral/src/TechnicalStandards/migrations/0003_norm_accessibility_norm_alternatives_and_more.py @@ -0,0 +1,155 @@ +# Generated by Django 5.0.9 on 2024-11-18 12:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("TechnicalStandards", "0002_delete_protocol"), + ("common", "0006_license_licensingfeerequirement_de_and_more"), + ("tools_over", "0008_alter_tools_technicalstandardsprotocols"), + ] + + operations = [ + migrations.AddField( + model_name="norm", + name="accessibility", + field=models.ManyToManyField( + db_comment="Accessibility - How accessible is the dataset?", + to="tools_over.accessibility", + ), + ), + migrations.AddField( + model_name="norm", + name="alternatives", + field=models.CharField( + blank=True, + help_text="Alternatives - Items with equal or likewise use case.", + max_length=300, + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="applicationArea", + field=models.ManyToManyField( + db_comment="Typical application area in which the item is used.", + to="tools_over.applicationarea", + ), + ), + migrations.AddField( + model_name="norm", + name="classification", + field=models.ManyToManyField( + db_comment="General type of item - Which type or of to which typ belongs the item. E.g. framework, programming language, ...", + to="tools_over.classification", + ), + ), + migrations.AddField( + model_name="norm", + name="developmentState", + field=models.IntegerField( + blank=True, + choices=[ + (1, "pre-alpha"), + (2, "alpha"), + (3, "beta"), + (4, "release candidate"), + (5, "release"), + ], + db_comment="Level of development - What is the curent development status", + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="focus", + field=models.ManyToManyField( + db_comment="Focus identifier - Selected focus (Definied by Wissensplattform)", + max_length=200, + to="tools_over.focus", + ), + ), + migrations.AddField( + model_name="norm", + name="furtherInformation", + field=models.CharField( + blank=True, + db_comment="Further information - Information of miscellaneous subjects", + max_length=1200, + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="image", + field=models.ImageField( + blank=True, + db_comment="File name of image file. Located in media-folder.", + null=True, + upload_to="", + ), + ), + migrations.AddField( + model_name="norm", + name="license", + field=models.ManyToManyField( + db_comment="under which license was the dataset published and are there any costs associated with using the dataset?", + to="common.license", + ), + ), + migrations.AddField( + model_name="norm", + name="lifeCyclePhase", + field=models.ManyToManyField( + db_comment="Life cycle phase - In which phase of the product life cycle is the tool used?", + to="tools_over.lifecyclephase", + ), + ), + migrations.AddField( + model_name="norm", + name="programmingLanguages", + field=models.CharField( + blank=True, + db_comment="Programming languages - Which programming languages are mainly used to implment the item.", + max_length=500, + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="provider", + field=models.CharField( + blank=True, + db_comment="Developers/maintainers/provider - Person or organisation responsible for the development of the item.", + max_length=300, + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="released", + field=models.BooleanField( + blank=True, + db_comment="Released - Is the publication done?", + null=True, + ), + ), + migrations.AddField( + model_name="norm", + name="scale", + field=models.ManyToManyField( + db_comment="Spatial scale of the use cases - On what scale is the dataset used?", + to="tools_over.scale", + ), + ), + migrations.AddField( + model_name="norm", + name="targetGroup", + field=models.ManyToManyField( + db_comment="Target group - Who do you say the digital item is aimed at?", + to="tools_over.targetgroup", + ), + ), + ] diff --git a/webcentral/src/TechnicalStandards/models.py b/webcentral/src/TechnicalStandards/models.py index 751dd1553..bf045f07e 100644 --- a/webcentral/src/TechnicalStandards/models.py +++ b/webcentral/src/TechnicalStandards/models.py @@ -1,128 +1,146 @@ from django.db import models from django.contrib.auth.models import User +from common.models import ( + ApplicationArea, + Focus, + LifeCyclePhase, + Scale, + TargetGroup, + Accessibility, + Classification, + License, + Usage, +) +from project_listing.models import Subproject -class TechnicalStandard(models.Model): - isNorm = models.BooleanField(default=True) +class Norm(models.Model): + # isNorm = models.BooleanField(default=True) name = models.CharField( - max_length=150, help_text="name of the norm", blank=True + max_length=150, + help_text="name of the norm", + blank=True, + db_comment="Name of the item", ) - link = models.CharField(max_length=150, help_text="link", blank=True) - - class Meta: - abstract = True # tells Django not to create a database table - - def __str__(self): - return self.name - - -class Norm(TechnicalStandard): + resources = models.CharField( + max_length=1000, + help_text="link", + blank=True, + db_comment="Sources of information - sources for further information about the item e.g. git repo, project website, ...", + ) + title = models.CharField( - max_length=250, help_text="title of the norm", blank=True + max_length=250, + help_text="title of the norm", + blank=True, + db_comment="full title of the norm", ) - shortDescription = models.TextField( - max_length=600, help_text="short description" + description = models.TextField( + max_length=1000, + help_text="short description", + default=None, + blank=True, + null=True, + db_comment="Description of the item.", ) source = models.CharField(max_length=100, help_text="source", blank=True) + applicationArea = models.ManyToManyField( + ApplicationArea, + db_comment="Typical application area in which the item is used.", + ) + classification = models.ManyToManyField( + Classification, + db_comment="General type of item - Which type or of to which typ belongs the item. E.g. framework, programming language, ...", + ) + focus = models.ManyToManyField( + Focus, + max_length=200, + db_comment="Focus identifier - Selected focus (Definied by Wissensplattform)", + ) + lifeCyclePhase = models.ManyToManyField( + LifeCyclePhase, + db_comment="Life cycle phase - In which phase of the product life cycle is the tool used?", + ) + scale = models.ManyToManyField( + Scale, + db_comment="Spatial scale of the use cases - On what scale is the dataset used?", + ) + targetGroup = models.ManyToManyField( + TargetGroup, + db_comment="Target group - Who do you say the digital item is aimed at?", + ) + alternatives = models.CharField( + max_length=300, + help_text="Alternatives - Items with equal or likewise use case.", + blank=True, + null=True, + db_comment="Alternatives - items with equal or likewise use case.", + ) + choices = [ + (1, "pre-alpha"), + (2, "alpha"), + (3, "beta"), + (4, "release candidate"), + (5, "release"), + ] + developmentState = models.IntegerField( + choices=choices, + null=True, + blank=True, + db_comment="Level of development - What is the curent development status", + ) + furtherInformation = models.CharField( + max_length=1200, + null=True, + blank=True, + db_comment="Further information - Information of miscellaneous subjects", + ) + image = models.ImageField( + null=True, + blank=True, + db_comment="File name of image file. Located in media-folder.", + ) + released = models.BooleanField( + blank=True, + null=True, + db_comment="Released - Is the publication done?", + ) + license = models.ManyToManyField( + License, + db_comment="under which license was the dataset published and are there any costs associated with using the dataset?", + ) + accessibility = models.ManyToManyField( + Accessibility, + db_comment="Accessibility - How accessible is the dataset?", + ) + programmingLanguages = models.CharField( + max_length=500, + blank=True, + null=True, + db_comment="Programming languages - Which programming languages are mainly used to implment the item.", + ) + provider = models.CharField( + max_length=300, + null=True, + blank=True, + db_comment="Developers/maintainers/provider - Person or organisation responsible for the development of the item.", + ) + specificApplication = models.ManyToManyField( + Subproject, + blank=True, + db_comment="Specific use cases - Identification of concrete examples of the use of the item in the construction sector/energy transition (equals project number)", + ) + yearOfRelease = models.CharField( + blank=True, + max_length=100, + help_text="year of software release (planned or conducted)", + db_comment="Year of publication - If the item is published, in which year was it released?", + null=True, + ) + usage = models.ManyToManyField( + Usage, + db_comment="Use type - What purpose is the item used for? (Simulation, monitoring, optimization, planning, control advanced control)", + ) def __str__(self): return self.name - - -# class Protocol(TechnicalStandard): -# communicationMediumCategory = models.CharField( -# max_length=150, -# help_text="Übertragungsmethoden (verkabelt, drahtlos oder verkabelt und drahtlos)", -# blank=True, -# ) -# supportedTransmissionMediuems = models.CharField( -# max_length=150, help_text="Unterstützte Übertragungsmedien", blank=True -# ) -# associatedStandards = models.CharField( -# max_length=200, -# help_text="Zugehörige Standards (Spezifische Standards, denen jedes Protokoll entspricht)", -# blank=True, -# ) -# openSourceStatus = models.CharField( -# max_length=50, -# help_text="Open-Source-Status (Ob Spezifikationen öffentlich und frei verfügbar sind oder nicht)", -# blank=True, -# ) -# licensingFeeRequirement = models.CharField( -# max_length=150, -# help_text="Lizenzgebühr (Gebühr zur Abdeckung der Kosten für Tests und Zertifizierung)", -# blank=True, -# ) -# networkTopology = models.CharField( -# max_length=150, -# help_text="Netzwerktopologie (Physische und logische Anordnung von Geräten in einem Netzwerk)", -# blank=True, -# ) -# security = models.CharField( -# max_length=150, -# help_text="Implementierte Sicherheitmechanismen", -# blank=True, -# ) -# bandwidth = models.CharField( -# max_length=150, help_text="Bandbreite", blank=True -# ) -# frequency = models.CharField( -# max_length=100, help_text="Frequenz", blank=True -# ) -# range = models.CharField(max_length=150, help_text="Reichweite", blank=True) -# numberOfConnectedDevices = models.CharField( -# max_length=5, -# help_text="Geräte (maximale Anzahl an Geräten, die vernetzt werden können)", -# blank=True, -# ) -# dataModelArchitecture = models.CharField( -# max_length=150, -# help_text="Datenmodell Architektur (Datenmodell, in dem die Informationen/Attribute zu einem Objekt hinzugefügt werden)", -# blank=True, -# ) -# discovery = models.CharField( -# max_length=10, -# help_text="Discovery (Funktion, um Geräte im Netzwerk automatisch zu identifzieren)", -# blank=True, -# ) -# # if BooleanField shall be used: input in the .csv should be True/False -# multiMaster = models.CharField( -# max_length=50, -# help_text="Multi Master (Können mehrere Mastergeräte zeitgleich agieren)", -# blank=True, -# ) -# # if BooleanField shall be used: input in the .csv should be True/False -# packetSize = models.CharField( -# max_length=10, -# help_text="Paketgröße (Datenpaketgröße, die nach Maximum Transmission Unit übertragen werden können)", -# blank=True, -# ) -# priorities = models.CharField( -# max_length=300, -# help_text="Priorität (Vorgehen, wie die Änderungen / Aktualisierungen vorgenommen werden)", -# blank=True, -# ) -# price = models.CharField( -# max_length=150, -# help_text="Kosten, um Hardwareuntersützung für weitere Protokolle zu ermöglichen (Gering, Durchschnittlich, Hoch)", -# blank=True, -# ) -# osiLayers = models.CharField( -# max_length=150, -# help_text="Implementierte OSI-Schichten (Anwendung [Application], Darstellung [Presentation], Sitzung [Session], Transport [Transport], Vermittlung/Paket [Network], Sicherung [Data Link], Bitübertragung [Phyiscal])", -# blank=True, -# ) -# buildingAutomationLayer = models.CharField( -# max_length=150, -# help_text="Ebenen der Gebäudeautomation (Feldebene, Automationsebene, Managementebene)", -# blank=True, -# ) -# exampleProject = models.CharField( -# max_length=250, -# help_text="Typische Anwendung (Beispielhafte Anwendung)", -# blank=True, -# ) -# image = models.ImageField(null=True, blank=True) -# -# def __str__(self): -# return self.name diff --git a/webcentral/src/TechnicalStandards/translation.py b/webcentral/src/TechnicalStandards/translation.py index e0d908d5a..8e3a6e459 100644 --- a/webcentral/src/TechnicalStandards/translation.py +++ b/webcentral/src/TechnicalStandards/translation.py @@ -4,9 +4,7 @@ ) from .models import ( - TechnicalStandard, Norm, - # Protocol, ) @@ -14,7 +12,7 @@ class NormTranslationOptions(TranslationOptions): fields = ( "title", "name", - "shortDescription", + # "shortDescription", "source", ) diff --git a/webcentral/src/TechnicalStandards/views.py b/webcentral/src/TechnicalStandards/views.py index f9337e4c2..cece93b93 100644 --- a/webcentral/src/TechnicalStandards/views.py +++ b/webcentral/src/TechnicalStandards/views.py @@ -7,9 +7,7 @@ from common.views import createQ from .models import ( - TechnicalStandard, Norm, - # Protocol, ) from protocols.models import Protocol diff --git a/webcentral/src/common/templatetags/template_tags.py b/webcentral/src/common/templatetags/template_tags.py index 5008feac9..d74783de2 100644 --- a/webcentral/src/common/templatetags/template_tags.py +++ b/webcentral/src/common/templatetags/template_tags.py @@ -12,3 +12,30 @@ def get_attribute(value, arg): """Gets an attribute of an object dynamically from a string name""" return getattr(value, arg) + +@register.filter +def get_m2m_or_attr(djangoModelObj, argStr): + """Get a attribute from a django-model and return the value. + + The argument can also encode a table connection with the __ syntax. + E.g. `license__openSourceStatus` means the attribute `openSourceStatus` + in the table, which is connected through the `license` attribute. + + """ + + if "__" in argStr: + try: + m2mAttr, attributeInReferencedTable = argStr.split("__") + if isinstance(m2mAttr, str) and isinstance(attributeInReferencedTable, str): + returnStr = "" + for connectedObj in getattr(djangoModelObj, m2mAttr).all(): + returnStr += getattr(connectedObj, attributeInReferencedTable) + ", " + return returnStr[:-1] + else: + raise TypeError("Only one __ should be present in the argument string.") + except: + pass + + else: + return get_attribute(djangoModelObj, argStr) + diff --git a/webcentral/src/protocols/views.py b/webcentral/src/protocols/views.py index 47aa5d062..f4e5021b4 100644 --- a/webcentral/src/protocols/views.py +++ b/webcentral/src/protocols/views.py @@ -85,6 +85,8 @@ def protocol(request): """Auf dieser Seite befinden sich unterschiedliche technische Protokolle, die im Sommer 2023 erfasst worden sind.""" ), "pathToExplanationTemplate": "TechnicalStandards/protocol-explanation.html", + "listingSubHeadingOneKey": _("Reichweite"), + "listingSubHeadingOneValue": "range", "optionList": [ { "placeholder": "Name", diff --git a/webcentral/src/templates/TechnicalStandards/protocol-listings.html b/webcentral/src/templates/TechnicalStandards/protocol-listings.html index 4a396b597..c37edd53c 100644 --- a/webcentral/src/templates/TechnicalStandards/protocol-listings.html +++ b/webcentral/src/templates/TechnicalStandards/protocol-listings.html @@ -95,7 +95,7 @@