Skip to content

Commit

Permalink
Merge 492dbfe into 1bb3751
Browse files Browse the repository at this point in the history
  • Loading branch information
LePetitTim authored Jan 16, 2023
2 parents 1bb3751 + 492dbfe commit 5982161
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ In preparation for HD Views developments (PR #3298)
- Recreate cache folders if missing. (#3384)
- Modify site's geometry before saving to avoid edition and export of shapefiles (#3399)
- Fix API V2 cache key with X-Forwarded-Proto header (#3404)
- Check pictogram exist on categories during generation of pdfs


2.94.0 (2022-12-12)
Expand Down
2 changes: 1 addition & 1 deletion geotrek/diving/templates/diving/dive_public_pdf_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</header>
<div class="gray">
<div>
{% if object.practice %}
{% if object.practice and object.practice.pictogram %}
<div class="main-icon category-D{{ object.practice.pk }}" {% block picto_attr %}{% endblock picto_attr %}>
<img src="file://{{ object.practice.pictogram.path }}" alt="">
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</header>
<div class="gray">
{% if object.parent_sites.first.practice.pictogram %}
{% if object.parent_sites.first.practice and object.parent_sites.first.practice.pictogram %}
<div class="main-icon category-S{{ object.parent_sites.first.practice.pk }}">
<img src="file://{{ object.parent_sites.first.practice.pictogram.path }}" alt="">
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
</div>
</header>
<div class="gray">
{% if object.practice.pictogram %}
{% if object.practice and object.practice.pictogram %}
<div class="main-icon category-S{{ object.practice.pk }}" {% block picto_attr %}{% endblock picto_attr %}>
<img src="file://{{ object.practice.pictogram.path }}" alt="">
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</header>
<div class="gray">
<div>
{% if object.practice %}
{% if object.practice and object.practice.pictogram %}
<div class="main-icon category-T{{ object.practice.pk }}" {% block picto_attr %}{% endblock picto_attr %}>
<img src="file://{{ object.practice.pictogram.path }}" alt="">
</div>
Expand Down
15 changes: 14 additions & 1 deletion geotrek/trekking/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
TrekNetworkFactory, WebLinkFactory, AccessibilityFactory,
TrekRelationshipFactory, ServiceFactory, ServiceTypeFactory,
TrekWithServicesFactory, TrekWithInfrastructuresFactory,
TrekWithSignagesFactory)
TrekWithSignagesFactory, PracticeFactory)
from ..models import POI, Trek, Service, OrderedTrekChild


Expand Down Expand Up @@ -500,6 +500,19 @@ def test_list_in_csv(self):
self.assertEqual(row['Cities'], "Trifouilli, Refouilli")
self.assertEqual(row['Districts'], self.district.name)

@mock.patch('mapentity.helpers.requests')
def test_document_public_export_without_pictogram(self, mock_requests):
if self.model is None:
return # Abstract test should not run
mock_requests.get.return_value.status_code = 200
mock_requests.get.return_value.content = b'<p id="properties">Mock</p>'
practice = PracticeFactory.create(pictogram=None)
obj = self.modelfactory.create(practice=practice)
response = self.client.get(
reverse(f'{self.model._meta.app_label}:{self.model._meta.model_name}_printable',
kwargs={'lang': 'en', 'pk': obj.pk, 'slug': obj.slug}))
self.assertEqual(response.status_code, 200)


class TrekViewsLiveTests(CommonLiveTest):
model = Trek
Expand Down

0 comments on commit 5982161

Please sign in to comment.