Skip to content

Commit

Permalink
Added 'Short name' column to the Signal Set Model
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrotsko committed Dec 24, 2024
1 parent 06ffd0d commit 70a41d2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/signal_sets/migrations/0015_signalset_short_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-12-24 10:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('signal_sets', '0014_signalset_endpoint'),
]

operations = [
migrations.AddField(
model_name='signalset',
name='short_name',
field=models.CharField(blank=True, max_length=255, verbose_name='Signal Set short name'),
),
]
6 changes: 6 additions & 0 deletions src/signal_sets/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ class SignalSet(models.Model):
unique=True,
)

short_name: models.CharField = models.CharField(
verbose_name="Signal Set short name",
max_length=255,
blank=True,
)

description: models.TextField = models.TextField(
verbose_name="Signal Set description",
blank=True,
Expand Down
4 changes: 3 additions & 1 deletion src/signal_sets/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def fix_boolean_fields(row) -> Any:
class SignalSetResource(resources.ModelResource):

name = Field(attribute="name", column_name="Signal Set name* ")
short_name = Field(attribute="short_name", column_name="Signal Set Short Name")
description = Field(attribute="description", column_name="Signal Set Description*")
maintainer_name = Field(
attribute="maintainer_name", column_name="Maintainer/\nKey Contact *"
Expand All @@ -95,6 +96,7 @@ class SignalSetResource(resources.ModelResource):
column_name="Data Source",
widget=widgets.ForeignKeyWidget(DataSource, field="name"),
)
endpoint = Field(attribute="endpoint", column_name="Endpoint")
language = Field(attribute="language", column_name="Language (likely English) ")
version_number = Field(
attribute="version_number", column_name="Version Number \n(if applicable) "
Expand Down Expand Up @@ -154,12 +156,12 @@ class SignalSetResource(resources.ModelResource):
link_to_documentation = Field(
attribute="link_to_documentation", column_name="Link to documentation"
)
endpoint = Field(attribute="endpoint", column_name="Endpoint")

class Meta:
model = SignalSet
fields: list[str] = [
"name",
"short_name",
"description",
"maintainer_name",
"maintainer_email",
Expand Down

0 comments on commit 70a41d2

Please sign in to comment.