ajout de champs supplémentaires

This commit is contained in:
Jean-Marie Favreau 2023-10-28 21:56:10 +02:00
parent e69bf616ba
commit 806fc8f551
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,25 @@
# Generated by Django 4.2.1 on 2023-10-28 19:50
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0006_alter_category_color'),
]
operations = [
migrations.AddField(
model_name='event',
name='category',
field=models.ForeignKey(help_text='Category of the event', null=True, on_delete=django.db.models.deletion.SET_NULL, to='agenda_culturel.category', verbose_name='Category'),
),
migrations.AddField(
model_name='event',
name='tags',
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=64), blank=True, help_text='A list of tags that describe the event.', null=True, size=None, verbose_name='Tags'),
),
]

View File

@ -66,6 +66,8 @@ class Event(models.Model):
status = models.CharField(_("Status"), max_length=20, choices=STATUS.choices, default=STATUS.PUBLISHED)
category = models.ForeignKey(Category, verbose_name=_('Category'), help_text=_('Category of the event'), null=True, on_delete=models.SET_NULL)
start_day = models.DateField(verbose_name=_('Day of the event'), help_text=_('Day of the event'))
start_time = models.TimeField(verbose_name=_('Starting time'), help_text=_('Starting time'), blank=True, null=True)
@ -81,6 +83,8 @@ class Event(models.Model):
reference_urls = ArrayField(models.URLField(max_length=512), verbose_name=_('URLs'), help_text=_("List of all the urls where this event can be found."), blank=True, null=True)
tags = ArrayField(models.CharField(max_length=64), verbose_name=_('Tags'), help_text=_("A list of tags that describe the event."), blank=True, null=True)
def get_absolute_url(self):
return reverse("view_event", kwargs={"pk": self.pk, "extra": self.title})