speakers and reporters lists synchronized
This commit is contained in:
parent
fcb14990ae
commit
2237774cf8
|
@ -237,6 +237,26 @@ class SyncFromThemis(UtilityView):
|
|||
datetime.datetime.strptime(
|
||||
data.get(attr), '%Y-%m-%d').toordinal())
|
||||
|
||||
# initializing speakers list
|
||||
if not object.speakers:
|
||||
object.speakers = []
|
||||
|
||||
for attr in ('orateurs_seance', 'orateurs', 'orateurs_en_commission',
|
||||
'orateurs_en_seanceprop', 'orateurs_rapportcom',
|
||||
'orateurs_seance_reponse_orale'):
|
||||
if data.get(attr):
|
||||
speakers = data.get(attr)
|
||||
# check if the speakers is a list, which is not a case if
|
||||
# the field is of type 'Ministry or Deputy'
|
||||
if isinstance(speakers, list):
|
||||
object.speakers = list(set(object.speakers + speakers))
|
||||
else:
|
||||
if speakers not in object.speakers:
|
||||
object.speakers.append(speakers)
|
||||
|
||||
if data.get('rapporteurs'):
|
||||
object.reporters = data.get(attr)
|
||||
|
||||
if data.get('date_sanction_promulgation'):
|
||||
object.sanction_date = datetime.date.fromordinal(
|
||||
datetime.datetime.strptime(
|
||||
|
|
Reference in New Issue