misc: apply pre-commit-hooks (#74980)
This commit is contained in:
parent
d00a36bdcf
commit
eb5ea772de
|
@ -2,11 +2,13 @@ Source: passerelle-montpellier-sig
|
|||
Maintainer: Serghei Mihai <smihai@entrouvert.com>
|
||||
Section: python
|
||||
Priority: optional
|
||||
Build-Depends: dh-python, debhelper-compat (= 12), python3-setuptools, python3-all
|
||||
Build-Depends: debhelper-compat (= 12),
|
||||
dh-python,
|
||||
python3-all,
|
||||
python3-setuptools,
|
||||
Standards-Version: 3.9.1
|
||||
|
||||
Package: python3-passerelle-montpellier-sig
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, python3-pyproj, python3-requests
|
||||
Depends: python3-pyproj, python3-requests, ${misc:Depends}, ${python3:Depends}
|
||||
Description: Passerelle extension for Montpellier's GIS (Python 3)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.utils.text import slugify
|
||||
from django import forms
|
||||
from django.utils.text import slugify
|
||||
|
||||
from .models import MontpellierSig
|
||||
|
||||
|
@ -12,4 +12,4 @@ class MontpellierSigForm(forms.ModelForm):
|
|||
def save(self, commit=True):
|
||||
if not self.instance.slug:
|
||||
self.instance.slug = slugify(self.instance.title)
|
||||
return super(MontpellierSigForm, self).save(commit=commit)
|
||||
return super().save(commit=commit)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-11-19 13:51
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import requests
|
||||
import logging
|
||||
|
||||
import requests
|
||||
from django.db import models
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from passerelle.base.models import BaseResource
|
||||
from passerelle.utils.jsonresponse import APIError
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{% extends "passerelle/manage.html" %}
|
||||
|
||||
{% block more-user-links %}
|
||||
{{ block.super }}
|
||||
{% if object.id %}
|
||||
<a href="{% url 'montpellier-sig-view' slug=object.slug %}">{{ object.title }}</a>
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% if object.id %}
|
||||
<a href="{% url 'montpellier-sig-view' slug=object.slug %}">{{ object.title }}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>Montpellier SIG - {{ object.title }}</h2>
|
||||
<h2>Montpellier SIG - {{ object.title }}</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="buttons">
|
||||
<button>{% trans 'Confirm Deletion' %}</button>
|
||||
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
|
||||
</div>
|
||||
</form>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="buttons">
|
||||
<button>{% trans 'Confirm Deletion' %}</button>
|
||||
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,33 +2,33 @@
|
|||
{% load i18n passerelle %}
|
||||
|
||||
{% block endpoints %}
|
||||
<ul>
|
||||
<li>{% trans 'Listing communes:' %}
|
||||
<a href="{% url 'montpellier-sig-communes' slug=object.slug %}">{{ site_base_uri }}{% url 'montpellier-sig-communes' slug=object.slug %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing communes containing string :' %}
|
||||
<a href="{% url 'montpellier-sig-communes' slug=object.slug %}?q=montp">{{ site_base_uri }}{% url 'montpellier-sig-communes' slug=object.slug %}?q=montp</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets:' %}
|
||||
<a href="{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}">{{ site_base_uri }}{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets containing string:' %}
|
||||
<a href="{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}?q=com">{{ site_base_uri }}{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}?q=com</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets numbers of a commune containing specified string in street name:' %}
|
||||
<a href="{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}">{{ site_base_uri }}{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets numbers of a commune containing specified string in street name:' %}
|
||||
<a href="{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}">{{ site_base_uri }}{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}?q=<i><street_number></i></a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets and communes containing specified string in their name:' %}
|
||||
<a href="{% url 'montpellier-sig-voiecommune' slug=object.slug nom_rue='montp' %}">{{ site_base_uri }}{% url 'montpellier-sig-voiecommune' slug=object.slug nom_rue='montp' %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Get address by geographical position:' %}
|
||||
<a href="{% url 'montpellier-sig-adresse' slug=object.slug %}?lat=43.61&lon=3.87">{{ site_base_uri }}{% url 'montpellier-sig-adresse' slug=object.slug %}?lat=43.61&lon=3.87</a>
|
||||
</li>
|
||||
<li>{% trans 'Get quartier and sousquartier by street name and number:' %}
|
||||
<a href="{% url 'montpellier-sig-district' slug=object.slug insee=34172 nom_rue='ALL ALAIN CORNEAU' numero=66 %}">{{ site_base_uri }}{% url 'montpellier-sig-district' slug=object.slug insee=34172 nom_rue='ALL ALAIN CORNEAU' numero=66 %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>{% trans 'Listing communes:' %}
|
||||
<a href="{% url 'montpellier-sig-communes' slug=object.slug %}">{{ site_base_uri }}{% url 'montpellier-sig-communes' slug=object.slug %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing communes containing string :' %}
|
||||
<a href="{% url 'montpellier-sig-communes' slug=object.slug %}?q=montp">{{ site_base_uri }}{% url 'montpellier-sig-communes' slug=object.slug %}?q=montp</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets:' %}
|
||||
<a href="{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}">{{ site_base_uri }}{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets containing string:' %}
|
||||
<a href="{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}?q=com">{{ site_base_uri }}{% url 'montpellier-sig-voies' slug=object.slug insee=34172 %}?q=com</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets numbers of a commune containing specified string in street name:' %}
|
||||
<a href="{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}">{{ site_base_uri }}{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets numbers of a commune containing specified string in street name:' %}
|
||||
<a href="{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}">{{ site_base_uri }}{% url 'montpellier-voies-commune' slug=object.slug insee=34172 nom_rue='lauragais' %}?q=<i><street_number></i></a>
|
||||
</li>
|
||||
<li>{% trans 'Listing streets and communes containing specified string in their name:' %}
|
||||
<a href="{% url 'montpellier-sig-voiecommune' slug=object.slug nom_rue='montp' %}">{{ site_base_uri }}{% url 'montpellier-sig-voiecommune' slug=object.slug nom_rue='montp' %}</a>
|
||||
</li>
|
||||
<li>{% trans 'Get address by geographical position:' %}
|
||||
<a href="{% url 'montpellier-sig-adresse' slug=object.slug %}?lat=43.61&lon=3.87">{{ site_base_uri }}{% url 'montpellier-sig-adresse' slug=object.slug %}?lat=43.61&lon=3.87</a>
|
||||
</li>
|
||||
<li>{% trans 'Get quartier and sousquartier by street name and number:' %}
|
||||
<a href="{% url 'montpellier-sig-district' slug=object.slug insee=34172 nom_rue='ALL ALAIN CORNEAU' numero=66 %}">{{ site_base_uri }}{% url 'montpellier-sig-district' slug=object.slug insee=34172 nom_rue='ALL ALAIN CORNEAU' numero=66 %}</a>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,33 +3,33 @@
|
|||
{% load url from future %}
|
||||
|
||||
{% block more-user-links %}
|
||||
{{ block.super }}
|
||||
{% if not object.id %}
|
||||
<a href="{% url 'montpellier-sig-add' %}">{% trans 'Add Montpellier SIG Connector' %}</a>
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% if not object.id %}
|
||||
<a href="{% url 'montpellier-sig-add' %}">{% trans 'Add Montpellier SIG Connector' %}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>SIG - {% if object.id %}{{ object.title }}{% else %}{% trans 'New' %}{% endif %}</h2>
|
||||
<h2>SIG - {% if object.id %}{{ object.title }}{% else %}{% trans 'New' %}{% endif %}</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div id="form-content">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
</div>
|
||||
{% block buttons %}
|
||||
<div class="buttons">
|
||||
<button>{% trans "Save" %}</button>
|
||||
{% if object.id %}
|
||||
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
|
||||
{% else %}
|
||||
<a class="cancel" href="{% url 'add-connector' %}">{% trans 'Cancel' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</form>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div id="form-content">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
</div>
|
||||
{% block buttons %}
|
||||
<div class="buttons">
|
||||
<button>{% trans "Save" %}</button>
|
||||
{% if object.id %}
|
||||
<a class="cancel" href="{{ object.get_absolute_url }}">{% trans 'Cancel' %}</a>
|
||||
{% else %}
|
||||
<a class="cancel" href="{% url 'add-connector' %}">{% trans 'Cancel' %}</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,29 +1,27 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
from passerelle.urls_utils import decorated_includes, required, app_enabled
|
||||
from django.urls import re_path
|
||||
from passerelle.urls_utils import app_enabled, decorated_includes, required
|
||||
|
||||
from .views import *
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<slug>[\w,-]+)/communes$', CommunesView.as_view(), name='montpellier-sig-communes'),
|
||||
url(r'^(?P<slug>[\w,-]+)/voies/(?P<insee>\d+)$', VoiesView.as_view(), name='montpellier-sig-voies'),
|
||||
url(
|
||||
re_path(r'^(?P<slug>[\w,-]+)/communes$', CommunesView.as_view(), name='montpellier-sig-communes'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/voies/(?P<insee>\d+)$', VoiesView.as_view(), name='montpellier-sig-voies'),
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/voies/(?P<insee>\d+)/(?P<nom_rue>[\w ]+)/numero$',
|
||||
VoiesCommuneView.as_view(),
|
||||
name='montpellier-voies-commune',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/voiecommune/(?P<nom_rue>[\w ]+)$',
|
||||
VoieCommuneView.as_view(),
|
||||
name='montpellier-sig-voiecommune',
|
||||
),
|
||||
url(r'^(?P<slug>[\w,-]+)/reverse$', AdresseView.as_view(), name='montpellier-sig-adresse'),
|
||||
url(
|
||||
re_path(r'^(?P<slug>[\w,-]+)/reverse$', AdresseView.as_view(), name='montpellier-sig-adresse'),
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/quartier/(?P<insee>\d+)/(?P<nom_rue>[\w ]+)/(?P<numero>\d+)\w*/$',
|
||||
DistrictView.as_view(),
|
||||
name='montpellier-sig-district',
|
||||
),
|
||||
url(r'^(?P<slug>[\w,-]+)/viewer/$', ViewerUrlView.as_view(), name='montpellier-sig-viewer'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/viewer/$', ViewerUrlView.as_view(), name='montpellier-sig-viewer'),
|
||||
]
|
||||
|
|
|
@ -1,19 +1,17 @@
|
|||
import requests
|
||||
import unicodedata
|
||||
import pyproj
|
||||
|
||||
from django.views.generic.detail import SingleObjectMixin, DetailView
|
||||
from django.views.generic.edit import CreateView, UpdateView, DeleteView
|
||||
from django.views.generic.base import View, RedirectView
|
||||
import pyproj
|
||||
import requests
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.shortcuts import redirect
|
||||
|
||||
from django.utils.encoding import force_text
|
||||
|
||||
from django.views.generic.base import RedirectView, View
|
||||
from django.views.generic.detail import DetailView, SingleObjectMixin
|
||||
from django.views.generic.edit import CreateView, DeleteView, UpdateView
|
||||
from passerelle import utils
|
||||
|
||||
from .models import MontpellierSig
|
||||
from .forms import MontpellierSigForm
|
||||
from .models import MontpellierSig
|
||||
|
||||
prefix_map = {
|
||||
'ALL': 'ALLEE',
|
||||
|
|
8
setup.py
8
setup.py
|
@ -3,12 +3,12 @@
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from distutils.cmd import Command
|
||||
from distutils.command.build import build as _build
|
||||
|
||||
from setuptools import find_packages, setup
|
||||
from setuptools.command.install_lib import install_lib as _install_lib
|
||||
from setuptools.command.sdist import sdist
|
||||
from distutils.command.build import build as _build
|
||||
from distutils.cmd import Command
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
|
||||
class eo_sdist(sdist):
|
||||
|
@ -29,7 +29,7 @@ def get_version():
|
|||
tag exists, take 0.0- and add the length of the commit log.
|
||||
"""
|
||||
if os.path.exists('VERSION'):
|
||||
version_file = open('VERSION', 'r')
|
||||
version_file = open('VERSION')
|
||||
version = version_file.read()
|
||||
version_file.close()
|
||||
return version
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import json
|
||||
import httmock
|
||||
|
||||
import httmock
|
||||
from django.test import TestCase
|
||||
from django.test.client import Client
|
||||
from passerelle.utils.jsonresponse import APIError
|
||||
|
||||
from passerelle_montpellier_sig.models import MontpellierSig
|
||||
from passerelle_montpellier_sig.views import prefix_cleanup, split_street
|
||||
from passerelle.utils.jsonresponse import APIError
|
||||
|
||||
|
||||
class PrefixCleanupTestCase(TestCase):
|
||||
|
|
Loading…
Reference in New Issue