Projet

Général

Profil

0001-lingo-show-return-url-on-regie-edit-page-56649.patch

Lauréline Guérin, 01 octobre 2021 10:53

Télécharger (2,27 ko)

Voir les différences:

Subject: [PATCH 1/2] lingo: show return url on regie edit page (#56649)

 combo/apps/lingo/manager_views.py                | 1 +
 combo/apps/lingo/templates/lingo/regie_form.html | 5 +++--
 tests/test_lingo_manager.py                      | 2 ++
 3 files changed, 6 insertions(+), 2 deletions(-)
combo/apps/lingo/manager_views.py
52 52
    def get_context_data(self, **kwargs):
53 53
        ctx = super().get_context_data(**kwargs)
54 54
        ctx['callback_url'] = self.request.build_absolute_uri(self.object.callback_url)
55
        ctx['return_url'] = self.request.build_absolute_uri(reverse('lingo-return', args=[self.object.pk]))
55 56
        return ctx
56 57

  
57 58

  
combo/apps/lingo/templates/lingo/regie_form.html
11 11

  
12 12
{% block content %}
13 13
<form method="post" enctype="multipart/form-data">
14
  {% if object.id and callback_url %}
15
    <p><label>{% trans "Callback URL:" %}</label> {{ callback_url }}</p>
14
  {% if object.pk %}
15
  {% if callback_url %}<p><label>{% trans "Callback URL:" %}</label> {{ callback_url }}</p>{% endif %}
16
  {% if return_url %}<p><label>{% trans "Return URL:" %}</label> {{ return_url }}</p>{% endif %}
16 17
  {% endif %}
17 18
  {% csrf_token %}
18 19
  {{ form.as_p }}
tests/test_lingo_manager.py
74 74
        % payment_backend.slug
75 75
        in resp
76 76
    )
77
    regie = Regie.objects.all()[0]
78
    assert '<p><label>Return URL:</label> http://testserver/lingo/return/%s/</p>' % regie.pk in resp
77 79

  
78 80
    resp.forms[0]['description'] = 'other description'
79 81
    resp = resp.forms[0].submit()
80
-