0001-pricing-add-links-from-agenda-to-pricing-and-reverse.patch
lingo/manager/static/css/style.scss | ||
---|---|---|
31 | 31 |
width: 2em; |
32 | 32 |
height: 100%; |
33 | 33 |
box-sizing: border-box; |
34 |
font-weight: normal;
|
|
34 |
font-weight: normal;
|
|
35 | 35 |
} |
36 | 36 |
} |
37 | 37 | |
... | ... | |
43 | 43 |
} |
44 | 44 |
} |
45 | 45 |
} |
46 | ||
47 |
ul.objects-list.single-links li a.delete::before { |
|
48 |
content: "\f08e"; /* fa-external-link */ |
|
49 |
} |
lingo/pricing/templates/lingo/pricing/manager_agenda_detail.html | ||
---|---|---|
23 | 23 |
{% if agenda_pricings %} |
24 | 24 |
<ul class="objects-list single-links"> |
25 | 25 |
{% for agenda_pricing in agenda_pricings %} |
26 |
<li><a href="{% url 'lingo-manager-agenda-pricing-detail' agenda.pk agenda_pricing.pk %}">{{ agenda_pricing.pricing }} ({{ agenda_pricing.date_start|date:'d/m/Y' }} - {{ agenda_pricing.date_end|date:'d/m/Y' }})</a></li> |
|
26 |
<li> |
|
27 |
<a href="{% url 'lingo-manager-agenda-pricing-detail' agenda.pk agenda_pricing.pk %}">{{ agenda_pricing.pricing }} ({{ agenda_pricing.date_start|date:'d/m/Y' }} - {{ agenda_pricing.date_end|date:'d/m/Y' }})</a> |
|
28 |
<a href="{% url 'lingo-manager-pricing-detail' agenda_pricing.pricing.pk %}" class="link-action-icon delete">voir</a> |
|
29 |
</li> |
|
27 | 30 |
{% endfor %} |
28 | 31 |
</ul> |
29 | 32 |
{% else %} |
lingo/pricing/templates/lingo/pricing/manager_pricing_detail.html | ||
---|---|---|
71 | 71 |
{% endwith %} |
72 | 72 |
</div> |
73 | 73 |
</div> |
74 | ||
75 |
<div class="section"> |
|
76 |
<h3>{% trans "Used in agendas" %}</h3> |
|
77 |
<div> |
|
78 |
{% if agendas %} |
|
79 |
<ul class="objects-list single-links"> |
|
80 |
{% for agenda in agendas %} |
|
81 |
<li> |
|
82 |
<a href="{% url 'lingo-manager-agenda-detail' pk=agenda.pk %}"> |
|
83 |
{{ agenda.label }} |
|
84 |
</a> |
|
85 |
</li> |
|
86 |
{% endfor %} |
|
87 |
</ul> |
|
88 |
{% else %} |
|
89 |
<div class="big-msg-info"> |
|
90 |
{% blocktrans %} |
|
91 |
This Pricing model is not used yet. |
|
92 |
{% endblocktrans %} |
|
93 |
</div> |
|
94 |
{% endif %} |
|
95 |
</div> |
|
96 |
</div> |
|
74 | 97 |
{% endblock %} |
lingo/pricing/views.py | ||
---|---|---|
259 | 259 |
) |
260 | 260 |
) |
261 | 261 | |
262 |
def get_context_data(self, **kwargs): |
|
263 |
kwargs['agendas'] = Agenda.objects.filter( |
|
264 |
pk__in=AgendaPricing.objects.filter(pricing=self.object).values('agenda') |
|
265 |
) |
|
266 |
return super().get_context_data(**kwargs) |
|
267 | ||
262 | 268 | |
263 | 269 |
pricing_detail = PricingDetailView.as_view() |
264 | 270 |
tests/pricing/manager/test_agenda.py | ||
---|---|---|
58 | 58 |
assert agenda_pricing.date_start == datetime.date(2022, 9, 1) |
59 | 59 |
assert agenda_pricing.date_end == datetime.date(2023, 9, 1) |
60 | 60 | |
61 |
resp = app.get('/manage/pricing/agenda/%s/' % agenda.pk) |
|
62 |
assert AgendaPricing.objects.filter(agenda=agenda, pricing=pricing).count() == 2 |
|
63 |
assert resp.text.count('"/manage/pricing/%s/"' % pricing.pk) == 2 |
|
64 | ||
61 | 65 | |
62 | 66 |
def test_edit_agenda_pricing(app, admin_user): |
63 | 67 |
agenda = Agenda.objects.create(label='Foo Bar') |
tests/pricing/manager/test_pricing.py | ||
---|---|---|
1 |
import datetime |
|
2 | ||
1 | 3 |
import pytest |
2 | 4 | |
3 |
from lingo.pricing.models import Criteria, CriteriaCategory, Pricing, PricingCriteriaCategory |
|
5 |
from lingo.agendas.models import Agenda |
|
6 |
from lingo.pricing.models import AgendaPricing, Criteria, CriteriaCategory, Pricing, PricingCriteriaCategory |
|
4 | 7 |
from tests.utils import login |
5 | 8 | |
6 | 9 |
pytestmark = pytest.mark.django_db |
... | ... | |
28 | 31 |
assert '/manage/pricing/%s/edit/' % pricing.pk in resp |
29 | 32 |
assert '/manage/pricing/%s/delete/' % pricing.pk in resp |
30 | 33 | |
34 |
agenda = Agenda.objects.create(label='Foo Bar') |
|
35 |
AgendaPricing.objects.create( |
|
36 |
agenda=agenda, |
|
37 |
pricing=pricing, |
|
38 |
date_start=datetime.date(year=2021, month=9, day=1), |
|
39 |
date_end=datetime.date(year=2022, month=9, day=1), |
|
40 |
) |
|
41 |
AgendaPricing.objects.create( |
|
42 |
agenda=agenda, |
|
43 |
pricing=pricing, |
|
44 |
date_start=datetime.date(year=2022, month=9, day=1), |
|
45 |
date_end=datetime.date(year=2023, month=9, day=1), |
|
46 |
) |
|
47 |
resp = app.get('/manage/pricing/%s/' % pricing.pk) |
|
48 |
assert resp.text.count('"/manage/pricing/agenda/%s/"' % agenda.pk) == 1 |
|
49 | ||
31 | 50 | |
32 | 51 |
def test_edit_pricing(app, admin_user): |
33 | 52 |
pricing = Pricing.objects.create(label='Model 1') |
34 |
- |