All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- internal areas added to choices in Area and AreaRelationship models
Added Linkedin contact type
Arearelationships can now be of type DEP, to account for countries depending on other countries (and areas dependencies, in general)
Migrations reset to initial only.
.gitlab-ci-yml
added with flake8 syntax tests and release on pypi (with test)
The main development focuses have been to keep up with latest Django
versions and to "modernize" the code base, adopting latest Python features (like type hinting), and doing some serious
housekeeping. Python 2 is no longer supported.
This release also implements a lot of new models which are not part of the Popolo specification (mildly out of scope),
but we needed them in some projects which make use this package. Those new models can be safely ignored, and they could
also be removed in the future, as we are considering the option of entirely decoupling them from django-popolo
.
That would probably be the right choice, but would also require a lot of development time which we currently don't have.
Below a semi-complete list of changes.
- Django 2.x support.
- Mild type hinting
Area.geometry
geo-spatial field (requires GeoDjango).Area.coordinates
property.RoleType
model to map structured roles for posts (off-spec).- Shortcuts in Organization QuerySets to extract institutions and organs (IT locale only).
- Add
Makefile
add_classification
can now acceptallow_same_scheme
parameter, to allow multiple classifications with the same scheme- Person can now receive
classifications
. - Target latest 2 Django LTS versions (1.11 and 2.2 at the moment)
- Target the second-last Python version (3.7 at the moment)
- Require GeoDjango
- Use F-strings when possible
- Tests now cover all methods implemented in the models (possibly).
- original and normalized education levels and profession names are unique.
- original and normalized education levels and profession are now storable.
Organization
has athematic_classification
field (off-spec).add_classification
andadd_classification_rel
methods decoupled.LinkShortcutsMixin.update_links
method implemented.SourceShortcutsMixin.update_sources
method implemented.ContactDetailShortcutsMixin.update_contact_details
method implemented.- Add
AKAs
choice toOtherName.othername_type
choices. - Adopted
factory_boy
package to generate model instances in tests. - Implemented test "factories" for the main models (see
popolo.tests.factories
module). - ClassificationShortcutMixin methods adjusted to work with nested Classification objects.
- Re-worked
update_classifications
method in ClassificationMixin. update_other_names
andupdate_identifiers
mixins implemented.Membership.label
field max length increased to 512 characters.Membership
class got methods to compute related apical roles and electoral events.get_apicals
get_electoral_event
this_and_next_electoral_events
,
- Drop Python 2 support
behaviors.models.Permalink.get_absolute_url
method removed. It was unused and relied on deprecated Django APIs.@python_2_unicode_compatible
decorator in model classes (also removed from version 3.0 of Django).management
sub-package (including Popit importer, which was broken anyway) is removed.
Area.geom
field (superseded byArea.geometry
). Read-only backward compatibility is provided bygeom
property.Area.gps_lat
field (superseded byArea.geometry
). Read-only backward compatibility is provided bygps_lat
property.Area.gps_lon
field (superseded byArea.geometry
). Read-only backward compatibility is provided bygps_lon
property.
electoral_result
foreign key added toMembership
.
Profession
andEducationLevel
models added.profession
andeducation_level
foreign keys added toPerson
, referring toProfession
andEducationLevel
.
- Classification code and descr fields can now be null, in order to use this class for tagging.
- constituency_descr_tmp and electoral_list_descr_tmp moved from Area to Membership.
- role fields max_length in Membership and Post objects increased to 512.
- get_former_parents and get_former_children moment_date parameter can be null.
- get_former_parents and get_former_children FIP classification_type corrected.
constituency_descr
andelectoral_list_descr
fields temporarily added to Membership in order to store relevant information contained in the Openpolitici dataset (will be removed when the whole subject will be refactored).- Multiple overlapping memberships are possible if the
allow_overlap
flag is specified.
birth_location
andbirth_location_area
fields added to Person.- person helper methods to add roles and memberships.
- helper methods of the previous pointcheck for overlapping dates, in order to allow duplicate roles or memberships for the same Organizations and Posts.
str
method added to LinkRel, SourceRel and ClassificationRel classes.- fixed ordering of queryset results in determining overlapping dates
in
add_other_names
, that resulted in tests failing on some platforms. str
for ClassificationRel, LinkRel and SourceRel now correctly ouput a string, not a tuple.
Compatibility with Popit importer broken! Due to changes in how Links and Sources are modeled, the Popit importer is not working any longer.
- Area class refined
- Area class shortcuts methods implemented and tested
- AreaRelationship class added to map generic relationships among Areas
- Classification added for
- Links, Sources and Classifications are related to generic objects through *Rel…classes, in order to minimize unnecessary repetitions in the tables.
- Shortcuts to filter type of areas added to AreaQuerySet.
- Common methods and testcases oved into Dateframeable and DateframeableTestCase
- Unicity of ContactDetail, OtherName and Identifier is enforced in the
add_x
shortcut methods. Identifiers validation take into account overlapping dates intervals. Overlapping identical values are merged into a single identifier whose start and end dates are extended. - IdentifierQueryset added to handle date filters for identifiers
popolo.utils.PartialDate
andpopolo.utils.PartialDatesInterval
added to handle partial dates computations and comparisons.- opdm-service project layout now follows our template at https://gitlab.depp.it/openpolis/django-project-template.
add_identifiers
tests now encompass many use cases.
- The importers were removed, due to broken backward compatibility introduced in the models.
- ElectoralEvent shortcuts to create ElectoralResults added.
- ElectoralEvent and ElectoralResult classes added.
- personal relationships modelling added.
- models and tests refactored in order to distribute shortcuts and tests through mixins.
- source added to Identifier.
- tests now encompass on_behalf_of relations.
- Event class added to instances.
- Main entities primary keys are now numerical IDs.
- django-popolo models aligned to popolo schemas.
- Italian translation in models and admin.
- Area and inline AreaI18Names admin classes.
models.py
code readability increased.
- added tests for importer.
popit
importer substituted by thepopolo_json
importer.- simplified
popolo_create_from_popit
management task. - updated travis matrix to latest python (3.6) and django (1.11) releases.
urls.py
is now compatible with django 1.8>, and does not cause errors in django 1.11.