Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add selects and dropdown values #98

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions doc/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ auto-close the issue that this PR fixes.

Remove any options that are not applicable.

- I have reviewed the [how-to guide](./how-to.md) and the [contributing file](../CONTRIBUTING.md).
- I have reviewed the [how-to guide](./how-to.md) and the
[contributing file](../CONTRIBUTING.md).
- I have run required [code checks](./how-to.md#run-code-checks) and resolved
any blockers.
- I have created the necessary [tests](../src/app_test.py) to
show my changes are effective and work as intended.
- I have created the necessary [tests](../src/app_test.py) to show my changes
are effective and work as intended.
- I have thoroughly commented my code, especially in more complex areas.
- I have updated any necessary documentation.

Expand Down
53 changes: 53 additions & 0 deletions src/affiliations/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,67 @@

# Third-party dependencies:
from django.contrib import admin
from django import forms

# In-house code:
from affiliations.models import Affiliation


class AffiliationForm(forms.ModelForm):
"""Create forms to display information in Admin page."""

class Meta:
"""Meta class for forms"""

fields = "__all__"
model = Affiliation
widgets = {
"status": forms.Select(
choices=[
("Active", "Active"),
("Applying", "Applying"),
("Inactive", "Inactive"),
("Retired", "Retired"),
]
),
"type": forms.Select(
choices=[
("Variant Curation Expert Panel", "Variant Curation Expert Panel"),
("Gene Curation Expert Panel", "Gene Curation Expert Panel"),
("Independent Curation Group", "Independent Curation Group"),
]
),
"clinical_domain_working_group": forms.Select(
choices=[
("None", "None"),
("Cardiovascular", "Cardiovascular"),
("Hearing Loss", "Hearing Loss"),
("Hemostasis/Thrombosis", "Hemostasis/Thrombosis"),
("Hereditary Cancer", "Hereditary Cancer"),
("Immunology", "Immunology"),
("Inborn Errors of Metabolism", "Inborn Errors of Metabolism"),
("Kidney Disease", "Kidney Disease"),
("Neurodevelopmental Disorders", "Neurodevelopmental Disorders"),
("Neurological Disorders", "Neurological Disorders"),
("Ocular", "Ocular"),
("Other", "Other"),
("Pulmonary", "Pulmonary"),
("RASopathy", "RASopathy"),
(
"Rheumatologic Autoimmune Disease",
"Rheumatologic Autoimmune Disease",
),
("Skeletal Disorders", "Skeletal Disorders"),
("Somatic Cancer", "Somatic Cancer"),
]
),
}


class AffiliationsAdmin(admin.ModelAdmin):
"""Configure the affiliations admin panel."""

form = AffiliationForm
search_fields = ["affiliation_id", "full_name", "abbreviated_name"]
list_display = [
"affiliation_id",
Expand Down
18 changes: 18 additions & 0 deletions src/affiliations/migrations/0006_alter_affiliation_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-07-24 19:30

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("affiliations", "0005_rename_name_affiliation_abbreviated_name_and_more"),
]

operations = [
migrations.AlterField(
model_name="affiliation",
name="status",
field=models.CharField(default=None),
),
]
18 changes: 18 additions & 0 deletions src/affiliations/migrations/0007_alter_affiliation_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-07-24 19:32

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("affiliations", "0006_alter_affiliation_status"),
]

operations = [
migrations.AlterField(
model_name="affiliation",
name="status",
field=models.CharField(blank=True),
),
]
18 changes: 18 additions & 0 deletions src/affiliations/migrations/0008_alter_affiliation_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-07-24 19:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("affiliations", "0007_alter_affiliation_status"),
]

operations = [
migrations.AlterField(
model_name="affiliation",
name="status",
field=models.CharField(),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.0.7 on 2024-07-24 19:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("affiliations", "0008_alter_affiliation_status"),
]

operations = [
migrations.AlterField(
model_name="affiliation",
name="abbreviated_name",
field=models.CharField(blank=True, null=True),
),
]
2 changes: 1 addition & 1 deletion src/affiliations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Affiliation(models.Model):

affiliation_id: models.IntegerField = models.IntegerField()
full_name: models.CharField = models.CharField()
abbreviated_name: models.CharField = models.CharField()
abbreviated_name: models.CharField = models.CharField(blank=True, null=True)
coordinator: models.CharField = models.CharField()
coordinator_email: models.EmailField = models.EmailField()
status: models.CharField = models.CharField()
Expand Down