Skip to content

Add community governance polls app #518

@bpepple

Description

@bpepple

Summary

Add a new polls Django app that allows site administrators to create governance polls — questions about project policy or rules — and lets registered users cast a single vote per poll within a defined date range.

Motivation

As the Metron community grows, admins need a transparent, structured way to propose and decide on site policies and rules. A fpolling feature keeps these decisions visible and participatory within the platform.

Proposed Data Model

Poll

Field Type Notes
title CharField Short label for the poll
description TextField Full proposal text / context
created_by FK → CustomUser Admin who created the poll
start_date DateTimeField Voting opens
end_date DateTimeField Voting closes
created_on DateTimeField Auto timestamp
modified DateTimeField Auto timestamp

PollChoice

Field Type Notes
poll FK → Poll Parent poll
text CharField Answer option label
order PositiveIntegerField Display order

PollVote

Field Type Notes
poll FK → Poll Poll voted on
choice FK → PollChoice Selected answer
user FK → CustomUser Voter
voted_on DateTimeField Auto timestamp

Constraint: unique_together = ("poll", "user") — one vote per user per poll.

Permissions

  • Create / edit / delete polls: staff users only (or a dedicated polls editor group, following the existing reading list editor pattern).
  • Vote: any authenticated registered user, only while start_date ≤ now ≤ end_date.
  • View results: any authenticated user; shown after the user votes or after end_date.

UI / UX

  • /polls/ — list of active, upcoming, and closed polls.
  • /polls/<id>/ — detail page with description, choices, and vote form (HTMX-powered; no full-page reload on submit).
  • Results displayed as percentages / bar chart after voting or after poll closes.
  • Bulma CSS components throughout; dark-mode safe (no hardcoded color classes).

Django Admin

  • Poll admin with inline PollChoice editing.
  • Read-only PollVote records for audit purposes.

Out of Scope (v1)

  • Multi-select or ranked-choice voting
  • REST API endpoints
  • Email notifications when a new poll opens (most likely best to add after the site updates to Django-6.*)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions