Skip to content
Open
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
5 changes: 4 additions & 1 deletion .safety-policy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
30 changes: 28 additions & 2 deletions every_election/apps/organisations/views/admin/organisation.py
Original file line number Diff line number Diff line change
@@ -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]
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down