From 70ed66337536937d3fe95512231c1228c2360a66 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 21 Apr 2016 16:18:42 +0200 Subject: [PATCH] use keywords --- .../management/commands/festival-sync-eve-events.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/festival/management/commands/festival-sync-eve-events.py b/app/festival/management/commands/festival-sync-eve-events.py index 9c601a44..070cadbd 100644 --- a/app/festival/management/commands/festival-sync-eve-events.py +++ b/app/festival/management/commands/festival-sync-eve-events.py @@ -7,6 +7,8 @@ from django.contrib.auth.models import User from django.core.mail import EmailMessage import mezzanine_agenda.models as ma_models +from mezzanine.generic.models import AssignedKeyword, Keyword + import eve.models as eve_models @@ -64,14 +66,15 @@ class Command(BaseCommand): location.clean() location.save() event.location = location - event.tags = eve_event.event_category.name event.save() + keyword, _ = Keyword.objects.get_or_create(title=eve_event.event_category.name) + event.keywords.add(AssignedKeyword(keyword=keyword), bulk=False) eve_prices = eve_models.PriceManifestation.objects.filter(manifestation=manifestation) for price in eve_prices: event_price, c = ma_models.EventPrice.objects.get_or_create(value=float(price.value)) if event: - if not event_price in event.prices: + if not event_price in event.prices.all(): event.prices.add(event_price) if not first: -- 2.39.5