Skip to content

Commit

Permalink
feat: add poll.pipeline and pipeline admin
Browse files Browse the repository at this point in the history
  • Loading branch information
rdahis committed Nov 6, 2024
1 parent cf0b995 commit 93b1cd6
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
18 changes: 17 additions & 1 deletion backend/apps/api/v1/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,11 @@ class PollInline(admin.StackedInline):
"entity",
"frequency",
"latest",
"pipeline",
]
autocomplete_fields = [
"entity",
"pipeline",
]


Expand Down Expand Up @@ -1287,6 +1289,7 @@ class PollAdmin(admin.ModelAdmin):
]
autocomplete_fields = [
"entity",
"pipeline",
"raw_data_source",
"information_request",
]
Expand All @@ -1299,6 +1302,19 @@ class PollAdmin(admin.ModelAdmin):
"information_request",
]

class PipelineAdmin(admin.ModelAdmin):
readonly_fields = [
"id",
]
search_fields = [
"id",
"github_url",
]
list_display = [
"id",
"github_url",
]


admin.site.register(Analysis, AnalysisAdmin)
admin.site.register(AnalysisType, AnalysisTypeAdmin)
Expand All @@ -1322,7 +1338,7 @@ class PollAdmin(admin.ModelAdmin):
admin.site.register(MeasurementUnitCategory, MeasurementUnitCategoryAdmin)
admin.site.register(ObservationLevel, ObservationLevelAdmin)
admin.site.register(Organization, OrganizationAdmin)
admin.site.register(Pipeline)
admin.site.register(Pipeline, PipelineAdmin)
admin.site.register(RawDataSource, RawDataSourceAdmin)
admin.site.register(Status, StatusAdmin)
admin.site.register(Table, TableAdmin)
Expand Down
19 changes: 19 additions & 0 deletions backend/apps/api/v1/migrations/0049_poll_pipeline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.16 on 2024-11-06 04:14

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('v1', '0048_alter_observationlevel_options_and_more'),
]

operations = [
migrations.AddField(
model_name='poll',
name='pipeline',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='polls', to='v1.pipeline'),
),
]
7 changes: 7 additions & 0 deletions backend/apps/api/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,13 @@ class Poll(BaseModel):
)
frequency = models.IntegerField(blank=True, null=True)
latest = models.DateTimeField(blank=True, null=True)
pipeline = models.ForeignKey(
"Pipeline",
blank=True,
null=True,
on_delete=models.SET_NULL,
related_name="polls",
)
raw_data_source = models.ForeignKey(
"RawDataSource",
blank=True,
Expand Down

0 comments on commit 93b1cd6

Please sign in to comment.