Consolidate migration
This commit is contained in:
parent
02448cf4d4
commit
70ae92854f
@ -1,11 +1,11 @@
|
||||
# Generated by Django 4.2.9 on 2024-10-10 20:35
|
||||
|
||||
from django.db import migrations
|
||||
from agenda_culturel.models import Place
|
||||
from django.contrib.gis.geos import Point
|
||||
|
||||
def change_coord_format(apps, schema_editor):
|
||||
places = Place.objects.all()
|
||||
Place = apps.get_model("agenda_culturel", "Place")
|
||||
places = Place.objects.values("location", "location_pt").all()
|
||||
|
||||
for p in places:
|
||||
l = p.location.split(',')
|
||||
@ -13,14 +13,15 @@ def change_coord_format(apps, schema_editor):
|
||||
p.location_pt = Point(float(l[1]), float(l[0]))
|
||||
else:
|
||||
p.location_pt = Point(3.08333, 45.783329)
|
||||
p.save()
|
||||
p.save(update_fields=["location_pt"])
|
||||
|
||||
def reverse_coord_format(apps, schema_editor):
|
||||
places = Place.objects.all()
|
||||
Place = apps.get_model("agenda_culturel", "Place")
|
||||
places = Place.objects.values("location", "location_pt").all()
|
||||
|
||||
for p in places:
|
||||
p.location = ','.join([p.location_pt[1], p.location_pt[0]])
|
||||
p.save()
|
||||
p.save(update_fields=["location"])
|
||||
|
||||
|
||||
|
||||
|
@ -721,7 +721,6 @@ def export_event_ical(request, year, month, day, pk):
|
||||
|
||||
return response
|
||||
|
||||
|
||||
def export_ical(request):
|
||||
now = date.today()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user