Temporary migration task for family data
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
from .models import Traveller
|
from .models import Traveller, Family
|
||||||
|
|
||||||
|
|
||||||
def nightly_check_active_status():
|
def nightly_check_active_status():
|
||||||
@@ -9,3 +9,29 @@ def nightly_check_active_status():
|
|||||||
traveller._update_active_status()
|
traveller._update_active_status()
|
||||||
if start_date != traveller.travel_start_date or end_date != traveller.travel_end_date or is_active != traveller.is_active:
|
if start_date != traveller.travel_start_date or end_date != traveller.travel_end_date or is_active != traveller.is_active:
|
||||||
traveller.save()
|
traveller.save()
|
||||||
|
|
||||||
|
for traveller in Traveller.objects.all():
|
||||||
|
if Family.objects.filter(traveller=traveller).exists():
|
||||||
|
continue
|
||||||
|
fam = Family()
|
||||||
|
fam.traveller = traveller
|
||||||
|
fam.residential_address = traveller.residential_address
|
||||||
|
fam.residential_suburb = traveller.residential_suburb
|
||||||
|
fam.postal_address = traveller.postal_address
|
||||||
|
fam.parent_A_firstname = traveller.parent_A_firstname
|
||||||
|
fam.parent_A_lastname = traveller.parent_A_lastname
|
||||||
|
fam.parent_A_phone = traveller.parent_A_phone
|
||||||
|
fam.parent_A_email = traveller.parent_A_email
|
||||||
|
fam.parent_B_firstname = traveller.parent_B_firstname
|
||||||
|
fam.parent_B_lastname = traveller.parent_B_lastname
|
||||||
|
fam.parent_B_phone = traveller.parent_B_phone
|
||||||
|
fam.parent_B_email = traveller.parent_B_email
|
||||||
|
fam.emergency_contact_A_firstname = traveller.emergency_contact_A_firstname
|
||||||
|
fam.emergency_contact_A_lastname = traveller.emergency_contact_A_lastname
|
||||||
|
fam.emergency_contact_A_phone = traveller.emergency_contact_A_phone
|
||||||
|
fam.emergency_contact_A_relation = traveller.emergency_contact_A_firstname
|
||||||
|
fam.emergency_contact_B_firstname = traveller.emergency_contact_B_firstname
|
||||||
|
fam.emergency_contact_B_lastname = traveller.emergency_contact_B_lastname
|
||||||
|
fam.emergency_contact_B_phone = traveller.emergency_contact_B_firstname
|
||||||
|
fam.emergency_contact_B_relation = traveller.emergency_contact_B_relation
|
||||||
|
fam.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user