Ajout d'un pictogramme pour les catégories (pas encore affiché)
This commit is contained in:
parent
9fdd3edd0e
commit
62060925cd
@ -0,0 +1,29 @@
|
|||||||
|
# Generated by Django 4.2.9 on 2024-09-14 12:57
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('agenda_culturel', '0073_alter_event_location'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='category',
|
||||||
|
name='pictogram',
|
||||||
|
field=models.ImageField(blank=True, help_text='Pictogram of the category', max_length=1024, null=True, upload_to='', verbose_name='Pictogram'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='event',
|
||||||
|
name='category',
|
||||||
|
field=models.ForeignKey(default=None, help_text='Category of the event', null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.category', verbose_name='Category'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='recurrentimport',
|
||||||
|
name='defaultCategory',
|
||||||
|
field=models.ForeignKey(default=None, help_text='Category of each imported event', on_delete=django.db.models.deletion.SET_DEFAULT, to='agenda_culturel.category', verbose_name='Category'),
|
||||||
|
),
|
||||||
|
]
|
@ -107,6 +107,15 @@ class Category(models.Model):
|
|||||||
null=True,
|
null=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pictogram = models.ImageField(
|
||||||
|
verbose_name=_("Pictogram"),
|
||||||
|
help_text=_("Pictogram of the category"),
|
||||||
|
max_length=1024,
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.color is None:
|
if self.color is None:
|
||||||
existing_colors = [c.color for c in Category.objects.all()]
|
existing_colors = [c.color for c in Category.objects.all()]
|
||||||
|
Loading…
Reference in New Issue
Block a user