Repository: GeotrekCE/Geotrek-admin

Issue:
Outdoor - Pictogrammes pratiques et cotations



Discussion:

Resolving patch:
diff --git a/geotrek/outdoor/admin.py b/geotrek/outdoor/admin.py
--- a/geotrek/outdoor/admin.py
+++ b/geotrek/outdoor/admin.py
@@ -20,7 +20,7 @@ class SectorAdmin(MergeActionMixin, TranslationAdmin):
 
 @admin.register(Practice)
 class PracticeAdmin(MergeActionMixin, TranslationAdmin):
-    list_display = ('name', 'sector')
+    list_display = ('name', 'sector', 'pictogram_img')
     list_filter = ('sector', )
     search_fields = ('name', )
     merge_field = 'name'
@@ -44,7 +44,7 @@ class RatingScaleAdmin(MergeActionMixin, TranslationAdmin):
 
 @admin.register(Rating)
 class RatingAdmin(MergeActionMixin, TranslationAdmin):
-    list_display = ('name', 'scale', 'order', 'color_markup')
+    list_display = ('name', 'scale', 'order', 'color_markup', 'pictogram_img')
     list_filter = ('scale', 'scale__practice')
     search_fields = ('name', 'description', 'scale__name')
     merge_field = 'name'
diff --git a/geotrek/outdoor/migrations/0016_auto_20210125_0726.py b/geotrek/outdoor/migrations/0016_auto_20210125_0726.py
new file mode 100644
--- /dev/null
+++ b/geotrek/outdoor/migrations/0016_auto_20210125_0726.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.1.5 on 2021-01-25 07:26
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('outdoor', '0015_auto_20210122_1531'),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name='practice',
+            name='pictogram',
+            field=models.FileField(blank=True, max_length=512, null=True, upload_to='upload', verbose_name='Pictogram'),
+        ),
+        migrations.AddField(
+            model_name='rating',
+            name='pictogram',
+            field=models.FileField(blank=True, max_length=512, null=True, upload_to='upload', verbose_name='Pictogram'),
+        ),
+    ]
diff --git a/geotrek/outdoor/models.py b/geotrek/outdoor/models.py
--- a/geotrek/outdoor/models.py
+++ b/geotrek/outdoor/models.py
@@ -5,7 +5,7 @@
 from django.db.models import Q
 from django.utils.translation import gettext_lazy as _
 from geotrek.authent.models import StructureRelated
-from geotrek.common.mixins import TimeStampedModelMixin, AddPropertyMixin, PublishableMixin
+from geotrek.common.mixins import TimeStampedModelMixin, AddPropertyMixin, PublishableMixin, OptionalPictogramMixin
 from geotrek.common.utils import intersecting
 from geotrek.core.models import Path, Topology, Trail
 from geotrek.infrastructure.models import Infrastructure
@@ -29,7 +29,7 @@ def __str__(self):
         return self.name
 
 
-class Practice(models.Model):
+class Practice(OptionalPictogramMixin, models.Model):
     name = models.CharField(verbose_name=_("Name"), max_length=128)
     sector = models.ForeignKey(Sector, related_name="practices", on_delete=models.PROTECT,
                                verbose_name=_("Sector"), null=True, blank=True)
@@ -59,7 +59,7 @@ class Meta:
         ordering = ('practice', 'order', 'name')
 
 
-class Rating(models.Model):
+class Rating(OptionalPictogramMixin, models.Model):
     name = models.CharField(verbose_name=_("Name"), max_length=128)
     scale = models.ForeignKey(RatingScale, related_name="ratings", on_delete=models.PROTECT,
                               verbose_name=_("Scale"))


Test patch: