Ajout d'une description aux lieux

Fix #204
This commit is contained in:
Jean-Marie Favreau 2024-11-20 16:49:09 +01:00
parent 09c2c2117c
commit 463dd6b3b9
5 changed files with 32 additions and 2 deletions

View File

@ -0,0 +1,19 @@
# Generated by Django 4.2.9 on 2024-11-20 15:42
from django.db import migrations
import django_ckeditor_5.fields
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0111_alter_referencelocation_main'),
]
operations = [
migrations.AddField(
model_name='place',
name='description',
field=django_ckeditor_5.fields.CKEditor5Field(blank=True, help_text='Description of the place, including accessibility.', null=True, verbose_name='Description'),
),
]

View File

@ -419,6 +419,13 @@ class Place(models.Model):
city = models.CharField(verbose_name=_("City"), help_text=_("City name"))
location = LocationField(based_fields=["name", "address", "city"], zoom=12, default=Point(3.08333, 45.783329))
description = CKEditor5Field(
verbose_name=_("Description"),
help_text=_("Description of the place, including accessibility."),
blank=True,
null=True,
)
aliases = ArrayField(
models.CharField(max_length=512),
verbose_name=_("Alternative names"),

View File

@ -49,6 +49,10 @@
{% endif %}
{% endwith %}
</ul>
{% if object.description %}
<h2>Description du lieu</h2>
{{ object.description|safe }}
{% endif %}
</div>
<div>
<div id="map_location" style="width: 100%; aspect-ratio: 16/16"></div>

View File

@ -31,7 +31,7 @@
</div>
</form>
{% if event %}
<h2>Description du lieu&nbsp;:</h2>
<h2>Détails de l'événement&nbsp;:</h2>
{% include "agenda_culturel/single-event/event-single-inc.html" with event=event noedit=1 %}
{% endif %}
</article>

View File

@ -944,7 +944,7 @@ def event_search(request, full=False):
tags = [t for t in tags if s_q == t[1]]
tags.sort(key=lambda x: x[1])
tags = [t[0] for t in tags]
places = Place.objects.filter(Q(name__icontains=request.GET['q']))
places = Place.objects.filter(Q(name__icontains=request.GET['q'])|Q(description__icontains=request.GET['q'])|Q(city__icontains=request.GET['q']))
paginator = PaginatorFilter(filter, 10, request)
page = request.GET.get("page")