Follows the changes in custommail

This commit is contained in:
Martin Pépin 2016-12-24 14:02:54 +01:00
parent 9482ab4416
commit dd60c58bb8
2 changed files with 51 additions and 51 deletions

View file

@ -5,7 +5,7 @@ Import des mails de GestioCOF dans la base de donnée
import json
import os
from custommail.models import VariableType, CustomMail, CustomMailVariable
from custommail.models import Type, CustomMail, Variable
from django.core.management.base import BaseCommand
from django.contrib.contenttypes.models import ContentType
@ -45,12 +45,12 @@ class Command(BaseCommand):
if obj['model'] == 'custommail.variabletype':
fields['inner1'] = assoc['types'].get(fields['inner1'])
fields['inner2'] = assoc['types'].get(fields['inner2'])
if fields['typ'] == 'model':
if fields['kind'] == 'model':
fields['content_type'] = (
ContentType.objects
.get_by_natural_key(*fields['content_type'])
)
var_type, _ = VariableType.objects.get_or_create(**fields)
var_type, _ = Type.objects.get_or_create(**fields)
assoc['types'][obj['pk']] = var_type
# Custom mails
@ -70,14 +70,14 @@ class Command(BaseCommand):
# Variables
if obj['model'] == 'custommail.custommailvariable':
fields['custommail'] = assoc['mails'].get(fields['custommail'])
fields['typ'] = assoc['types'].get(fields['typ'])
fields['type'] = assoc['types'].get(fields['type'])
try:
CustomMailVariable.objects.get(
Variable.objects.get(
custommail=fields['custommail'],
name=fields['name']
)
except CustomMailVariable.DoesNotExist:
CustomMailVariable.objects.create(**fields)
except Variable.DoesNotExist:
Variable.objects.create(**fields)
# C'est agréable d'avoir le résultat affiché
self.stdout.write(

View file

@ -8,7 +8,7 @@
"user"
],
"inner1": null,
"typ": "model",
"kind": "model",
"inner2": null
}
},
@ -18,7 +18,7 @@
"fields": {
"content_type": null,
"inner1": null,
"typ": "int",
"kind": "int",
"inner2": null
}
},
@ -31,7 +31,7 @@
"spectacle"
],
"inner1": null,
"typ": "model",
"kind": "model",
"inner2": null
}
},
@ -44,7 +44,7 @@
"spectaclerevente"
],
"inner1": null,
"typ": "model",
"kind": "model",
"inner2": null
}
},
@ -57,7 +57,7 @@
"site"
],
"inner1": null,
"typ": "model",
"kind": "model",
"inner2": null
}
},
@ -70,7 +70,7 @@
"petitcoursdemande"
],
"inner1": null,
"typ": "model",
"kind": "model",
"inner2": null
}
},
@ -80,7 +80,7 @@
"fields": {
"content_type": null,
"inner1": null,
"typ": "list",
"kind": "list",
"inner2": null
}
},
@ -90,7 +90,7 @@
"fields": {
"content_type": null,
"inner1": 1,
"typ": "list",
"kind": "list",
"inner2": null
}
},
@ -100,7 +100,7 @@
"fields": {
"content_type": null,
"inner1": null,
"typ": "pair",
"kind": "pair",
"inner2": 8
}
},
@ -110,7 +110,7 @@
"fields": {
"content_type": null,
"inner1": 9,
"typ": "list",
"kind": "list",
"inner2": null
}
},
@ -120,7 +120,7 @@
"fields": {
"content_type": null,
"inner1": 3,
"typ": "list",
"kind": "list",
"inner2": null
}
},
@ -261,7 +261,7 @@
"name": "member",
"description": "Utilisateur de GestioCOF",
"custommail": 1,
"typ": 1
"type": 1
}
},
{
@ -271,7 +271,7 @@
"name": "member",
"description": "Utilisateur ayant eu une place pour ce spectacle",
"custommail": 2,
"typ": 1
"type": 1
}
},
{
@ -281,7 +281,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 2,
"typ": 3
"type": 3
}
},
{
@ -291,7 +291,7 @@
"name": "nb_attr",
"description": "Nombre de places obtenues",
"custommail": 2,
"typ": 2
"type": 2
}
},
{
@ -301,7 +301,7 @@
"name": "revente",
"description": "Revente mentionn\u00e9e dans le mail",
"custommail": 3,
"typ": 4
"type": 4
}
},
{
@ -311,7 +311,7 @@
"name": "member",
"description": "Personne int\u00e9ress\u00e9e par la place",
"custommail": 3,
"typ": 1
"type": 1
}
},
{
@ -321,7 +321,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 3,
"typ": 3
"type": 3
}
},
{
@ -331,7 +331,7 @@
"name": "site",
"description": "Site web (gestioCOF)",
"custommail": 3,
"typ": 5
"type": 5
}
},
{
@ -341,7 +341,7 @@
"name": "site",
"description": "Site web (gestioCOF)",
"custommail": 4,
"typ": 5
"type": 5
}
},
{
@ -351,7 +351,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 4,
"typ": 3
"type": 3
}
},
{
@ -361,7 +361,7 @@
"name": "member",
"description": "Personne int\u00e9ress\u00e9e par la place",
"custommail": 4,
"typ": 1
"type": 1
}
},
{
@ -371,7 +371,7 @@
"name": "acheteur",
"description": "Gagnant-e du tirage",
"custommail": 5,
"typ": 1
"type": 1
}
},
{
@ -381,7 +381,7 @@
"name": "vendeur",
"description": "Personne qui vend une place",
"custommail": 5,
"typ": 1
"type": 1
}
},
{
@ -391,7 +391,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 5,
"typ": 3
"type": 3
}
},
{
@ -401,7 +401,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 6,
"typ": 3
"type": 3
}
},
{
@ -411,7 +411,7 @@
"name": "vendeur",
"description": "Personne qui vend une place",
"custommail": 6,
"typ": 1
"type": 1
}
},
{
@ -421,7 +421,7 @@
"name": "acheteur",
"description": "Personne inscrite au tirage qui n'a pas eu la place",
"custommail": 6,
"typ": 1
"type": 1
}
},
{
@ -431,7 +431,7 @@
"name": "acheteur",
"description": "Gagnant-e du tirage",
"custommail": 7,
"typ": 1
"type": 1
}
},
{
@ -441,7 +441,7 @@
"name": "vendeur",
"description": "Personne qui vend une place",
"custommail": 7,
"typ": 1
"type": 1
}
},
{
@ -451,7 +451,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 7,
"typ": 3
"type": 3
}
},
{
@ -461,7 +461,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 8,
"typ": 3
"type": 3
}
},
{
@ -471,7 +471,7 @@
"name": "vendeur",
"description": "Personne qui vend la place",
"custommail": 8,
"typ": 1
"type": 1
}
},
{
@ -481,7 +481,7 @@
"name": "revente",
"description": "Revente mentionn\u00e9e dans le mail",
"custommail": 8,
"typ": 4
"type": 4
}
},
{
@ -491,7 +491,7 @@
"name": "vendeur",
"description": "Personne qui vend la place",
"custommail": 9,
"typ": 1
"type": 1
}
},
{
@ -501,7 +501,7 @@
"name": "show",
"description": "Spectacle",
"custommail": 9,
"typ": 3
"type": 3
}
},
{
@ -511,7 +511,7 @@
"name": "acheteur",
"description": "Personne qui prend la place au shotgun",
"custommail": 9,
"typ": 1
"type": 1
}
},
{
@ -521,7 +521,7 @@
"name": "demande",
"description": "Demande de petit cours",
"custommail": 10,
"typ": 6
"type": 6
}
},
{
@ -531,7 +531,7 @@
"name": "matieres",
"description": "Liste des mati\u00e8res concern\u00e9es par la demande",
"custommail": 10,
"typ": 7
"type": 7
}
},
{
@ -541,7 +541,7 @@
"name": "proposals",
"description": "Liste associant une liste d'enseignants \u00e0 chaque mati\u00e8re",
"custommail": 11,
"typ": 10
"type": 10
}
},
{
@ -551,7 +551,7 @@
"name": "unsatisfied",
"description": "Liste des mati\u00e8res pour lesquelles on n'a pas d'enseigant \u00e0 proposer",
"custommail": 11,
"typ": 7
"type": 7
}
},
{
@ -561,7 +561,7 @@
"name": "places",
"description": "Places de spectacle du participant",
"custommail": 12,
"typ": 11
"type": 11
}
},
{
@ -571,7 +571,7 @@
"name": "member",
"description": "Participant du tirage au sort",
"custommail": 12,
"typ": 1
"type": 1
}
},
{
@ -581,7 +581,7 @@
"name": "member",
"description": "Participant du tirage au sort",
"custommail": 13,
"typ": 1
"type": 1
}
}
]