Django Inspire EU
=================

[![Django 2.0, 2.1, 2.2, 3.0, 3.1](https://img.shields.io/badge/django-2.0,%202.1,%202.2,%203.0,%203.1-092E20.svg)](https://www.djangoproject.com)
[![Documentation Status](https://readthedocs.org/projects/django-inspire-eu/badge/?version=latest)](https://django-inspire-eu.readthedocs.io/en/latest/?badge=latest)
[![image](https://badge.fury.io/py/django-inspire-eu.svg)](https://badge.fury.io/py/django-inspire-eu)
[![See Build Status on Travis CI](https://travis-ci.com/xusy2k/django-inspire-eu.svg?branch=master)](https://travis-ci.com/xusy2k/django-inspire-eu)
[![image](https://codecov.io/gh/xusy2k/django-inspire-eu/branch/master/graph/badge.svg)](https://codecov.io/gh/xusy2k/django-inspire-eu)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

This package is the django implementation from the
[themes](https://inspire.ec.europa.eu/Themes/Data-Specifications/2892)
of the infrastructure for spatial information in Europe (INSPIRE)

Documentation
-------------

The full documentation is at <https://django-inspire-eu.readthedocs.io>.

Quickstart
----------

1.  Install Django Inspire EU:

    > -   Stable version, preferably within a virtual environment:
    >
    >     >
    >     >     $ mkvirtualenv django-inspire-eu
    >     >     $ pip install django-inspire-eu
    >
    > -   Development version:
    >
    >     > ``` {.sourceCode .bash}
    >     > $ pip install -e git+https://github.com/xusy2k/django-inspire-eu.git@master#egg=django-inspire_eu
    >     > ```
    >
2.  Add it to your _INSTALLED\_APPS_:

    > ``` {.sourceCode .python}
    > INSTALLED_APPS = (
    >     ...
    >     "inspire_eu.apps.InspireEuConfig",
    >     ...
    > )
    > ```

3.  Customize [settings](https://django-inspire-eu.readthedocs.io/en/latest/settings.html):

    > -   [INSPIRE\_EU\_THEMES](https://django-inspire-eu.readthedocs.io/en/latest/settings.html#inspire-eu-themes)
    > -   [INSPIRE\_EU\_DEFAULT\_SRID](https://django-inspire-eu.readthedocs.io/en/latest/settings.html#inspire-eu-default-srid)
    > -   [INSPIRE\_EU\_BASE\_MODEL](https://django-inspire-eu.readthedocs.io/en/latest/settings.html#inspire-eu-base-model)
    > -   [MIGRATION\_MODULES](https://django-inspire-eu.readthedocs.io/en/latest/settings.html#migration-modules): **Very important** if you
    >     want avoid problems with migrations files


4.  Make and execute migrations:

    > ``` {.sourceCode .bash}
    > python manage.py makemigrations
    > python manage.py migrate
    > ```

5.  Populate base models:

    > This django command fetch values from
    > <https://inspire.ec.europa.eu>. In particular: Status:
    > ([valid](https://inspire.ec.europa.eu/registry/status/valid),
    > [invalid](https://inspire.ec.europa.eu/registry/status/invalid),
    > [retired](https://inspire.ec.europa.eu/registry/status/retired)),
    > [Theme](https://inspire.ec.europa.eu/theme/),
    > [Application Schema](https://inspire.ec.europa.eu/applicationschema/),
    > [Code List](https://inspire.ec.europa.eu/codelist/) and
    > For each Code List key, fetch all its Code List Values
    >
    > ``` {.sourceCode .bash}
    > python manage.py load_initial_inspire [-l <language>]  # Default: en
    > ```

6.  Add Django Inspire EU's URL patterns:

    > ``` {.sourceCode .python}
    > from inspire_eu import urls as inspire_eu_urls
    >
    > urlpatterns = [
    >     ...
    >     url(r"^", include(inspire_eu_urls)),
    >     ...
    > ]
    > ```

Working example
---------------

Follow steps at [django-example
directory](https://github.com/xusy2k/django-inspire-eu/tree/master/django-example/)

Running Tests
-------------

Does the code actually work?

    source <YOURVIRTUALENV>/bin/activate
    (myenv) $ pip install tox
    (myenv) $ tox

Development commands
--------------------

    pip install -r requirements_dev.txt
    invoke -l

Credits
-------

Tools used in rendering this package:

-   [Cookiecutter](https://github.com/audreyr/cookiecutter)
-   [cookiecutter-djangopackage](https://github.com/pydanny/cookiecutter-djangopackage)

History
-------

### 0.2.2 (2021-06-01)

-   Fixed related_name and related_query_name at AbstractOfficialArea model
-   Updated python-slugify according its documentation

### 0.2.1 (2021-03-19)

-   Added BaseInspireEUModel at CadastralZoning and CadastralParcel
-   Typo fixed AbstractCadastralParcel.national\_cadastal\_reference to
    AbstractCadastralParcel.national\_cadastral\_reference

### 0.2.0 (2021-02-26)

-   First release on PyPI.

### 0.1.0 (2021-02-07)

-   First release on GitHub.
