Package: django-councilmatic
django-councilmaticThe django-councilmatic app provides the core functionality for theCouncilmatic 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.RequirementsPython >= 3.6FeaturesModels for bills, people, organizations, events, and moreBase views for Bill, Person, Organization, and Event listing and detail pagesSearch infrastructure powered bydjango-haystackand SolrTheCouncilmatic familyincludes:Philly Councilmatic (the original and first Councilmatic, by Mjumbe Poe, an important predecessor to DataMade’s django-councilmatic)Chicago CouncilmaticLos Angeles Metro BoardCouncilmatic in your cityIf you’re interested in bringing Councilmatic to your city,contact us! We’d love to help.Want to build your own Councilmatic? Check out ourStarter Template. It contains everything you need to create your own Councilmatic from scratch.Extending Open Civic Data/Councilmatic modelsdjango-councilmatic leverages, and in some instaances, lightly extends the Open Civic Data Standard, implemented in Django aspython-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.SubclassingLeveragemulti-table inheritanceto 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 usingpupato scrape legislative data. Sincepupacreates OCD objects,django-councilmatic includes Django signalsto 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.Proxyingdjango-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 ofdjango-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 ofProxyForeignKey. Seecouncilmatic_core.models.BillActionfor an example.Running testsDid you make changes to django-councilmatic? Before you make a pull request, run some tests.First, install the test requirements:pipinstall-rtests/requirements.txtWe test for functionality withpytest:pytestIf 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 installeddjango-councilmaticwithpip install -e /path/to/django-councilmatic), install the test requirements:pipinstall-r/path/to/django-councilmatic/tests/test_requirements.txtAddfixture_magicto your instance’sINSTALLED_APPSinsettings.py.Run the management command to update the test fixture.pythonmanage.pymake_fixturesRun the tests and commit your updated fixture with your PR!Patches and ContributionsWe continue to improve django-councilmatic, and we welcome your ideas! You can make suggestions in the form ofgithub 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.CopyrightCopyright (c) 2023 Participatory Politics Foundation and DataMade.
Released under theMIT
License.