Skip to main content

django-councilmatic

The django-councilmatic app provides the core functionality for the Councilmatic family, a set of web apps for keeping tabs on local city council. It is built upon the Open Civic Data standard and ultimately makes Councilmatic easier to re-deploy in new cities.

Requirements

  • Python >= 3.8

Features

  • Models for bills, people, organizations, events, and more

  • Base views for Bill, Person, Organization, and Event listing and detail pages

  • Search infrastructure powered by django-haystack and Solr

The Councilmatic family includes:

Councilmatic in your city

If you’re interested in bringing Councilmatic to your city, contact us! We’d love to help.

Want to build your own Councilmatic? Check out our Starter Template. It contains everything you need to create your own Councilmatic from scratch.

Extending Open Civic Data/Councilmatic models

django-councilmatic leverages, and in some instaances, lightly extends the Open Civic Data Standard, implemented in Django as python-opencivicdata. If you’d like to add additional attributes or Python properties to your models, there are two approaches to be aware of: subclassing and proxying.

Subclassing

Leverage multi-table inheritance to add additional fields to OCD models. The primary use case in django-councilmatic is adding slugs to first-class models – Person, Event, Bill, and Organization - and adding metadata outside of the OCD standard, e.g., a headshot to Person and division boundaries to Post.

We recommend using pupa to scrape legislative data. Since pupa creates OCD objects, django-councilmatic includes Django signals to each of the subclassed models to create the related Councilmatic model on save. It also includes management commands to import metadata (see above).

If you subclass a model, be sure to include a signal to create instances of your subclass when the parent class is created, and, if applicable, some way to add any metadata, e.g., a management command or admin interface.

Proxying

django-councilmatic makes extensive use of proxy models to add custom managers and additional properties and methods to model classes. In order to take advantage of these elsewhere in the code, it is desirable for related objects to be returned as instances of other proxy classes or subclasses, rather than the upstream OCD model classes. In order to force related objects to be returned as Councilmatic models, django-councilmatic makes use of django-proxy-overrides.

If you wish to customize the class of related objects, first proxy an OCD model, then override one or more of its related object attributes with an instance of ProxyForeignKey. See councilmatic_core.models.BillAction for an example.

Running tests

Did you make changes to django-councilmatic? Before you make a pull request, run some tests.

First, install the test requirements:

pip install -r tests/requirements.txt

We test for functionality with pytest:

pytest

If you made material changes to the Councilmatic models, refresh the test fixture from a local instance database. From your instance directory (assuming you’ve already installed django-councilmatic with pip install -e /path/to/django-councilmatic), install the test requirements:

pip install -r /path/to/django-councilmatic/tests/test_requirements.txt

Add fixture_magic to your instance’s INSTALLED_APPS in settings.py.

Run the management command to update the test fixture.

python manage.py make_fixtures

Run the tests and commit your updated fixture with your PR!

Patches and Contributions

We continue to improve django-councilmatic, and we welcome your ideas! You can make suggestions in the form of github issues (bug reports, feature requests, general questions), or you can submit a code contribution via a pull request.

How to contribute code:

  • Fork the project.

  • Make your feature addition or bug fix.

  • Send us a pull request with a description of your work! Don’t worry if it isn’t perfect - think of a PR as a start of a conversation, rather than a finished product.

Metadata

Release files for django-councilmatic 3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-councilmatic 3.3
File Size Uploaded Provenance Actions
django-councilmatic-3.3.tar.gz 892.5 kB Without provenance Details for django-councilmatic-3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-councilmatic 3.3
File Interpreter ABI Platform Actions
django_councilmatic-3.3-py3-none-any.whl Python 3 none any Details for django_councilmatic-3.3-py3-none-any.whl

Total release size: 1.9 MB

Release files / django-councilmatic-3.3.tar.gz

Download URL django-councilmatic-3.3.tar.gz
Size 892.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8847d436af89f5eea4ff648a3d8e67473d1848dea8e1cf4f2f4c4007c1e60cc1
BLAKE2b-256 checksum
How to use checksums
aa7b108eab0621465a3dd858a9ec384f7b1db4fd445eefb03a151e754fd799a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Release files / django_councilmatic-3.3-py3-none-any.whl

Download URL django_councilmatic-3.3-py3-none-any.whl
Size 978.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cba5ad406afd3a70af26157ee08c3778038e0300f083dfb15fe0a059a7439214
BLAKE2b-256 checksum
How to use checksums
ca728f3e259410d1c3a68d812f92c47b157a2de1f36ac5d2a77edab2a7da518c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.9

Security for django-councilmatic 3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page