From 97d1c6ed8031aa23f0ca53caee39215f34575ed0 Mon Sep 17 00:00:00 2001 From: Sym Roe Date: Thu, 16 May 2024 08:24:31 +0100 Subject: [PATCH 1/3] Show elections for an organisation in the admin --- .../organisations/views/admin/organisation.py | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/every_election/apps/organisations/views/admin/organisation.py b/every_election/apps/organisations/views/admin/organisation.py index 189506dec..4a93fef44 100644 --- a/every_election/apps/organisations/views/admin/organisation.py +++ b/every_election/apps/organisations/views/admin/organisation.py @@ -1,6 +1,32 @@ from django.contrib import admin +from elections.models import Election + + +class ElectionForOrganisationInlineAdmin(admin.StackedInline): + model = Election + fields = ["election_id"] + can_delete = False + readonly_fields = ["election_id"] + show_change_link = True + extra = 0 + ordering = ["poll_open_date"] + + def has_add_permission(self, request, obj=None): + return False class OrganisationAdmin(admin.ModelAdmin): - search_fields = ("official_name", "common_name", "official_identifier") - readonly_fields = ["created", "modified"] + search_fields = ("common_name", "slug") + list_display = ("common_name", "active_period_text", "organisation_type") + list_filter = ("organisation_type", "territory_code", "election_types") + readonly_fields = [ + "created", + "modified", + "official_identifier", + "organisation_type", + "territory_code", + "organisation_subtype", + "slug", + ] + + inlines = [ElectionForOrganisationInlineAdmin] From c56111c2e20ed34ee2259462486d5807286d50c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 10:00:18 +0000 Subject: [PATCH 2/3] Bump sqlparse from 0.4.4 to 0.5.0 Bumps [sqlparse](https://github.com/andialbrecht/sqlparse) from 0.4.4 to 0.5.0. - [Changelog](https://github.com/andialbrecht/sqlparse/blob/master/CHANGELOG) - [Commits](https://github.com/andialbrecht/sqlparse/compare/0.4.4...0.5.0) --- updated-dependencies: - dependency-name: sqlparse dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements/base.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/base.txt b/requirements/base.txt index d73a07415..5d58c61a8 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -25,7 +25,7 @@ requests==2.31.0 retry2==0.9.5 scrapy==2.11.1 six==1.16.0 -sqlparse==0.4.4 +sqlparse==0.5.0 uk-election-ids==0.7.5 uk-election-timetables==2.4.1 uk-geo-utils==0.12.0 From 500f5131a4a5102e7d86d40167b534ba48d85bb9 Mon Sep 17 00:00:00 2001 From: Sym Roe Date: Thu, 16 May 2024 08:52:00 +0100 Subject: [PATCH 3/3] Ignore pip problems --- .safety-policy.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.safety-policy.yml b/.safety-policy.yml index b8f4a123a..3f47f6b0a 100644 --- a/.safety-policy.yml +++ b/.safety-policy.yml @@ -16,4 +16,7 @@ security: # configuration for the `safety check` command 66742: # Don't do stupid things with Black. We don't. Remove when we go to ruff reason: we do not use loads of leading tabs expires: '2025-01-20' # Bump if still applies - continue-on-vulnerability-error: False # Suppress non-zero exit codes when vulnerabilities are found. Enable this in pipelines and CI/CD processes if you want to pass builds that have vulnerabilities \ No newline at end of file + 67599: # Apparently all versions of pip are bad. + reason: We need to be able to pip install things. + expires: '2024-08-20' # Bump if still applies + continue-on-vulnerability-error: False # Suppress non-zero exit codes when vulnerabilities are found. Enable this in pipelines and CI/CD processes if you want to pass builds that have vulnerabilities