Projet

Général

Profil

0001-grandlyon-street-sections-remove-custom-template-414.patch

Frédéric Péters, 08 avril 2020 10:20

Télécharger (3,22 ko)

Voir les différences:

Subject: [PATCH 1/2] grandlyon street sections: remove custom template
 (#41446)

 .../grandlyon_streetsections/models.py        | 19 ++++++++++++--
 .../grandlyonstreetsections_detail.html       | 25 -------------------
 2 files changed, 17 insertions(+), 27 deletions(-)
 delete mode 100644 passerelle/contrib/grandlyon_streetsections/templates/grandlyon_streetsections/grandlyonstreetsections_detail.html
passerelle/contrib/grandlyon_streetsections/models.py
45 45
    class Meta:
46 46
        verbose_name = _('Sections of Grand Lyon Streets')
47 47

  
48
    @endpoint(perm='can_access')
49
    def section_info(self, request, streetname, streetnumber, commune):
48
    @endpoint(perm='can_access',
49
            description=_('Get details on a section'),
50
            parameters={
51
                'streetname': {
52
                    'description': _('Street name'),
53
                    'example_value': 'Boulevard du Raquin',
54
                },
55
                'streetnumber': {
56
                    'description': _('Street number'),
57
                    'example_value': '12',
58
                },
59
                'commune': {
60
                    'description': _('Collectivity'),
61
                    'example_value': 'Chassieu',
62
                },
63
            })
64
    def section_info(self, request, streetname, streetnumber, commune=None):
50 65
        sections = StreetSection.objects.filter(
51 66
                normalized_name=normalize_street(streetname),
52 67
                nomcommune__startswith=normalize_commune(commune))
passerelle/contrib/grandlyon_streetsections/templates/grandlyon_streetsections/grandlyonstreetsections_detail.html
1
{% extends "passerelle/manage/service_view.html" %}
2
{% load i18n passerelle %}
3

  
4
{% block endpoints %}
5
<ul class="endpoints">
6
    <li class="get-method">
7
        <span class="description">{% trans "Details on a section:" %}</span>
8
        {% url "generic-endpoint" connector="grandlyon-streetsections" slug=object.slug endpoint="section_info" as endpoint_path %}
9
        <a class="example-url" href="{{endpoint_path}}?streetname=Boulevard du Raquin&streetnumber=12&commune=Chassieu"
10
           >{{endpoint_path}}?streetname=Boulevard du Raquin&streetnumber=12&commune=Chassieu</a>
11
<pre>
12
{
13
   "data" : {
14
      "codefuv" : "22091",
15
      "codetroncon" : "T44368",
16
      "domanialite" : "Métropole",
17
      "nom" : "Boulevard du Raquin",
18
      "nomcommune" : "CHASSIEU"
19
   },
20
   "err" : 0
21
}
22
</pre>
23
    </li>
24
</ul>
25
{% endblock %}
26
-