Example #1
0
DO_UPDATES = False

# declare variables
FROM_person_id = None
TO_person_id = None
undo_switch_status = None
status_message_list = []
status_message = ""

# first, set the IDs of the persons we will be switching from and to.
#FROM_person_id = 136 # Matt VandenBunte
#TO_person_id = 591 # Matt VandeBunte

FROM_person_id = 318 # Myron Kulka
TO_person_id = 599 # Myron Kukla

# call PersonData.switch_persons_in_data()
undo_switch_status = PersonData.undo_switch_persons_in_data( FROM_person_id, TO_person_id, do_updates_IN = DO_UPDATES )

# Output summary
print( "switch_status = " + str( undo_switch_status.status_code ) )

# status messages
status_message_list = undo_switch_status.get_message_list()
for status_message in status_message_list:

    # output status message:
    print( "- " + status_message )

#-- END loop over status message list. --#
Example #2
0
# imports
import six

from django.db.models.fields.related_descriptors import ReverseManyToOneDescriptor
from django.db.models.fields.related_descriptors import ReverseOneToOneDescriptor

from python_utilities.objects.object_helper import ObjectHelper
from python_utilities.django_utils.django_model_helper import DjangoModelHelper

from sourcenet.data.person_data import PersonData
from sourcenet.models import Person

# get list of reverse lookup sets in Person.
reverse_lookup_name_list = PersonData.get_person_related_set_attribute_names()

# and again, to test cache - should not be any output.
reverse_lookup_name_list = PersonData.get_person_related_set_attribute_names()