On remplace "Autre" par "Sans catégorie"
This commit is contained in:
parent
956374b647
commit
2a6697b28d
@ -32,7 +32,7 @@ if __name__ == "__main__":
|
|||||||
url = "https://calendar.google.com/calendar/ical/programmation.lesaugustes%40gmail.com/public/basic.ics"
|
url = "https://calendar.google.com/calendar/ical/programmation.lesaugustes%40gmail.com/public/basic.ics"
|
||||||
url_human = "https://www.cafelesaugustes.fr/la-programmation/"
|
url_human = "https://www.cafelesaugustes.fr/la-programmation/"
|
||||||
|
|
||||||
events = u2e.process(url, url_human, cache = "cache-augustes.ical", default_values = {"category": "Autre", "location": "Café lecture les Augustes"}, published = True)
|
events = u2e.process(url, url_human, cache = "cache-augustes.ical", default_values = {"category": "Sans catégorie", "location": "Café lecture les Augustes"}, published = True)
|
||||||
|
|
||||||
exportfile = "events-augustes.json"
|
exportfile = "events-augustes.json"
|
||||||
print("Saving events to file {}".format(exportfile))
|
print("Saving events to file {}".format(exportfile))
|
||||||
|
@ -13,9 +13,9 @@ class CExtractor(TwoStepsExtractor):
|
|||||||
mapping = {
|
mapping = {
|
||||||
"Théâtre": "Théâtre",
|
"Théâtre": "Théâtre",
|
||||||
"Danse": "Danse",
|
"Danse": "Danse",
|
||||||
"Rencontre": "Autre",
|
"Rencontre": "Sans catégorie",
|
||||||
"Sortie de résidence": "Autre",
|
"Sortie de résidence": "Sans catégorie",
|
||||||
"PopCorn Live": "Autre",
|
"PopCorn Live": "Sans catégorie",
|
||||||
}
|
}
|
||||||
if category in mapping:
|
if category in mapping:
|
||||||
return mapping[category]
|
return mapping[category]
|
||||||
|
@ -10,11 +10,11 @@ class CExtractor(TwoStepsExtractor):
|
|||||||
mapping = {
|
mapping = {
|
||||||
"Musique": "Concert",
|
"Musique": "Concert",
|
||||||
"CONCERT": "Concert",
|
"CONCERT": "Concert",
|
||||||
"VISITE": "Autre",
|
"VISITE": "Sans catégorie",
|
||||||
"Spectacle": "Théâtre",
|
"Spectacle": "Théâtre",
|
||||||
"Rencontre": "Autre",
|
"Rencontre": "Sans catégorie",
|
||||||
"Atelier": "Autre",
|
"Atelier": "Sans catégorie",
|
||||||
"Projection": "Autre",
|
"Projection": "Sans catégorie",
|
||||||
}
|
}
|
||||||
if category in mapping:
|
if category in mapping:
|
||||||
return mapping[category]
|
return mapping[category]
|
||||||
|
@ -714,9 +714,12 @@ class Event(models.Model):
|
|||||||
|
|
||||||
def from_structure(event_structure, import_source=None):
|
def from_structure(event_structure, import_source=None):
|
||||||
if "category" in event_structure and event_structure["category"] is not None:
|
if "category" in event_structure and event_structure["category"] is not None:
|
||||||
|
try:
|
||||||
event_structure["category"] = Category.objects.get(
|
event_structure["category"] = Category.objects.get(
|
||||||
name=event_structure["category"]
|
name=event_structure["category"]
|
||||||
)
|
)
|
||||||
|
except Category.DoesNotExist:
|
||||||
|
event_structure["category"] = Category.get_default_category()
|
||||||
|
|
||||||
if "published" in event_structure and event_structure["published"] is not None:
|
if "published" in event_structure and event_structure["published"] is not None:
|
||||||
if event_structure["published"]:
|
if event_structure["published"]:
|
||||||
|
Loading…
Reference in New Issue
Block a user