wip/74979-compatibilite-django- (#74979) #1
|
@ -1,6 +1,16 @@
|
|||
# See https://pre-commit.com for more information
|
||||
# See https://pre-commit.com/hooks.html for more hooks
|
||||
repos:
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.10.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: ['--target-version', '2.2']
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
|
@ -11,11 +21,11 @@ repos:
|
|||
hooks:
|
||||
- id: isort
|
||||
args: ['--profile', 'black', '--line-length', '110']
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: 'v1.5.2'
|
||||
hooks:
|
||||
- id: djhtml
|
||||
args: ['--tabwidth', '2']
|
||||
- repo: https://git.entrouvert.org/pre-commit-debian.git
|
||||
rev: v0.1
|
||||
hooks:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{% extends "passerelle/manage.html" %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
{{ block.super }}
|
||||
{% if object.id %}
|
||||
<a href="{{object.get_absolute_url}}">{{ object.title }}</a>
|
||||
{% endif %}
|
||||
{{ block.super }}
|
||||
{% if object.id %}
|
||||
<a href="{{object.get_absolute_url}}">{{ object.title }}</a>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>{% trans 'Collect Days' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-collectday-add' %}">{% trans 'New' %}</a>
|
||||
<h2>{% trans 'Collect Days' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-collectday-add' %}">{% trans 'New' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li>{{ object }}
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-collectday-remove' pk=object.id %}"></a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no collect day yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li>{{ object }}
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-collectday-remove' pk=object.id %}"></a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no collect day yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>{{ commune }}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-streets-edit-view' pk=commune.pk %}">{% trans 'Edit streets' %}</a>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-edit' pk=commune.pk %}">{% trans 'Edit' %}</a>
|
||||
<h2>{{ commune }}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-streets-edit-view' pk=commune.pk %}">{% trans 'Edit streets' %}</a>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-edit' pk=commune.pk %}">{% trans 'Edit' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if streets %}
|
||||
<h3>{% trans "Limited by the following streets:" %}</h3>
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for street in streets %}
|
||||
<li>{{ street.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}Including all the streets. Click on "Edit streets" to add or delete streets.{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if streets %}
|
||||
<h3>{% trans "Limited by the following streets:" %}</h3>
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for street in streets %}
|
||||
<li>{{ street.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}Including all the streets. Click on "Edit streets" to add or delete streets.{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>{% trans 'Communes' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-add' %}">{% trans 'New' %}</a>
|
||||
<h2>{% trans 'Communes' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-commune-add' %}">{% trans 'New' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li><a href="{% url 'montpellier-encombrants-commune-view' pk=object.id %}">{{ object }}</a>
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-commune-remove' pk=object.id %}"></a> </li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no commune yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li><a href="{% url 'montpellier-encombrants-commune-view' pk=object.id %}">{{ object }}</a>
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-commune-remove' pk=object.id %}"></a> </li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no commune yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -3,31 +3,31 @@
|
|||
|
||||
{% block endpoints %}
|
||||
|
||||
<ul>
|
||||
<li>{% trans 'Listing available days:' %} <a href="{% url 'montpellier-encombrants-available-days' slug=object.slug insee=34088 %}"
|
||||
>{{ site_base_uri }}{% url 'montpellier-encombrants-view' slug=object.slug %}available/<i><insee></i></a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>{% trans 'Listing available days:' %} <a href="{% url 'montpellier-encombrants-available-days' slug=object.slug insee=34088 %}"
|
||||
>{{ site_base_uri }}{% url 'montpellier-encombrants-view' slug=object.slug %}available/<i><insee></i></a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block description %}
|
||||
{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
|
||||
<div>
|
||||
<h3>{% trans "Management" %}</h3>
|
||||
{% if perms.passerelle_montpellier_encombrants.change_passerelle_montpellier_encombrants %}
|
||||
<div>
|
||||
<h3>{% trans "Management" %}</h3>
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'montpellier-encombrants-sector-listing' %}">{% trans 'Sectors' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-commune-listing' %}">{% trans 'Communes' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-collectday-listing' %}">{% trans 'Collect Days' %}</a></li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="{% url 'montpellier-encombrants-sector-listing' %}">{% trans 'Sectors' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-commune-listing' %}">{% trans 'Communes' %}</a></li>
|
||||
<li><a href="{% url 'montpellier-encombrants-collectday-listing' %}">{% trans 'Collect Days' %}</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block security %}
|
||||
<p>
|
||||
{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
|
||||
</p>
|
||||
<p>
|
||||
{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
|
||||
</p>
|
||||
|
||||
{% access_rights_table resource=object permission='can_post_request' %}
|
||||
{% access_rights_table resource=object permission='can_post_request' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -2,29 +2,29 @@
|
|||
{% load i18n %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>{% trans 'Sectors' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-sector-add' %}">{% trans 'New' %}</a>
|
||||
<h2>{% trans 'Sectors' %}</h2>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-sector-add' %}">{% trans 'New' %}</a>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-sector-update' pk=object.id %}">{{ object }}</a>
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-sector-remove' pk=object.id %}"></a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no sector yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if object_list %}
|
||||
<div class="objects-list">
|
||||
<ul>
|
||||
{% for object in object_list %}
|
||||
<li>
|
||||
<a rel="popup" href="{% url 'montpellier-encombrants-sector-update' pk=object.id %}">{{ object }}</a>
|
||||
<a rel="popup" class="icon-remove-sign" href="{% url 'montpellier-encombrants-sector-remove' pk=object.id %}"></a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="big-msg-info">
|
||||
{% blocktrans %}
|
||||
There is no sector yet. Click on the "New" button in the top
|
||||
right of the page to add a first one.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -14,19 +14,19 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.urls import include, path, re_path
|
||||
from passerelle.urls_utils import app_enabled, decorated_includes, required
|
||||
|
||||
from .views import *
|
||||
|
||||
public_urlpatterns = [
|
||||
url(
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/$',
|
||||
EncombrantsManagementDetailView.as_view(),
|
||||
name='montpellier-encombrants-view',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/available/(?P<insee>\d+)$',
|
||||
AvailableDaysView.as_view(),
|
||||
name='montpellier-encombrants-available-days',
|
||||
|
@ -34,50 +34,52 @@ public_urlpatterns = [
|
|||
]
|
||||
|
||||
management_urlpatterns = [
|
||||
url(r'^add$', EncombrantsManagementCreateView.as_view(), name='montpellier-encombrants-add'),
|
||||
url(
|
||||
path('add', EncombrantsManagementCreateView.as_view(), name='montpellier-encombrants-add'),
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/edit$',
|
||||
EncombrantsManagementUpdateView.as_view(),
|
||||
name='montpellier-encombrants-edit',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/delete$',
|
||||
EncombrantsManagementDeleteView.as_view(),
|
||||
name='montpellier-encombrants-delete',
|
||||
),
|
||||
url(r'^sectors/$', SectorListView.as_view(), name='montpellier-encombrants-sector-listing'),
|
||||
url(r'^sectors/add$', SectorCreateView.as_view(), name='montpellier-encombrants-sector-add'),
|
||||
url(
|
||||
path('sectors/', SectorListView.as_view(), name='montpellier-encombrants-sector-listing'),
|
||||
path('sectors/add', SectorCreateView.as_view(), name='montpellier-encombrants-sector-add'),
|
||||
re_path(
|
||||
r'^sectors/(?P<pk>[\w,-]+)/$',
|
||||
SectorUpdateView.as_view(),
|
||||
name='montpellier-encombrants-sector-update',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^sectors/(?P<pk>[\w,-]+)/delete$',
|
||||
SectorDeleteView.as_view(),
|
||||
name='montpellier-encombrants-sector-remove',
|
||||
),
|
||||
url(r'^communes/$', CommuneListView.as_view(), name='montpellier-encombrants-commune-listing'),
|
||||
url(r'^communes/add$', CommuneCreateView.as_view(), name='montpellier-encombrants-commune-add'),
|
||||
url(
|
||||
path('communes/', CommuneListView.as_view(), name='montpellier-encombrants-commune-listing'),
|
||||
path('communes/add', CommuneCreateView.as_view(), name='montpellier-encombrants-commune-add'),
|
||||
re_path(
|
||||
r'^communes/(?P<pk>[\w,-]+)/edit$',
|
||||
CommuneUpdateView.as_view(),
|
||||
name='montpellier-encombrants-commune-edit',
|
||||
),
|
||||
url(r'^communes/(?P<pk>[\w,-]+)$', CommuneView.as_view(), name='montpellier-encombrants-commune-view'),
|
||||
url(
|
||||
re_path(
|
||||
r'^communes/(?P<pk>[\w,-]+)$', CommuneView.as_view(), name='montpellier-encombrants-commune-view'
|
||||
),
|
||||
re_path(
|
||||
r'^communes/(?P<pk>[\w,-]+)/streets$',
|
||||
StreetEditView.as_view(),
|
||||
name='montpellier-encombrants-commune-streets-edit-view',
|
||||
),
|
||||
url(
|
||||
re_path(
|
||||
r'^communes/(?P<pk>[\w,-]+)/delete$',
|
||||
CommuneDeleteView.as_view(),
|
||||
name='montpellier-encombrants-commune-remove',
|
||||
),
|
||||
url(r'^collectdays/$', CollectDayListView.as_view(), name='montpellier-encombrants-collectday-listing'),
|
||||
url(r'^collectdays/add$', CollectDayCreateView.as_view(), name='montpellier-encombrants-collectday-add'),
|
||||
url(
|
||||
path('collectdays/', CollectDayListView.as_view(), name='montpellier-encombrants-collectday-listing'),
|
||||
path('collectdays/add', CollectDayCreateView.as_view(), name='montpellier-encombrants-collectday-add'),
|
||||
re_path(
|
||||
r'^collectdays/(?P<pk>[\w,-]+)/delete$',
|
||||
CollectDayDeleteView.as_view(),
|
||||
name='montpellier-encombrants-collectday-remove',
|
||||
|
@ -87,8 +89,8 @@ management_urlpatterns = [
|
|||
urlpatterns = required(
|
||||
app_enabled('passerelle_montpellier_encombrants'),
|
||||
[
|
||||
url(r'^montpellier-encombrants/', include(public_urlpatterns)),
|
||||
url(
|
||||
re_path(r'^montpellier-encombrants/', include(public_urlpatterns)),
|
||||
re_path(
|
||||
r'^manage/montpellier-encombrants/',
|
||||
decorated_includes(login_required, include(management_urlpatterns)),
|
||||
),
|
||||
|
|
12
tox.ini
12
tox.ini
|
@ -1,5 +1,5 @@
|
|||
[tox]
|
||||
envlist = py3-django22-black-junit-coverage
|
||||
envlist = py3-django32-codestyle-junit-coverage
|
||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle-montpellier-encombrants/{env:BRANCH_NAME:}
|
||||
|
||||
[testenv]
|
||||
|
@ -14,15 +14,15 @@ setenv =
|
|||
coverage: COVERAGE=--cov-report xml --cov-report html --cov=passerelle_montpellier_encombrants/
|
||||
junit: JUNIT=--junitxml=junit-{envname}.xml
|
||||
deps =
|
||||
django22: django>=2.2, <2.3
|
||||
django32: django>=3.2, <3.3
|
||||
https://git.entrouvert.org/entrouvert/passerelle/archive/main.tar.gz
|
||||
psycopg2-binary<2.9
|
||||
psycopg2-binary
|
||||
xmlschema<1.1
|
||||
psycopg2<2.9
|
||||
psycopg2
|
||||
pytest
|
||||
pytest-cov
|
||||
pytest-django
|
||||
black: pre-commit
|
||||
codestyle: pre-commit
|
||||
commands =
|
||||
py.test {posargs: {env:JUNIT:} {env:COVERAGE:} tests/}
|
||||
black: pre-commit run black --all-files --show-diff-on-failure
|
||||
codestyle: pre-commit run --all-files --show-diff-on-failure
|
||||
|
|
Loading…
Reference in New Issue