19 lines
545 B
Python
19 lines
545 B
Python
|
|
||
|
def checkForShadowCall(sender, instance, created, raw, **kwargs):
|
||
|
""" Check for existing shadow call. If present copy it's data and delete it. """
|
||
|
if created:
|
||
|
# to prevent circular imports we import ShadowCall here
|
||
|
from .models import ShadowCall
|
||
|
|
||
|
try:
|
||
|
shadow = ShadowCall.objects.get(username=instance.username)
|
||
|
instance.ref = shadow.ref
|
||
|
instance.location = shadow.location
|
||
|
instance.opName = shadow.opName
|
||
|
instance.regTime = shadow.regTime
|
||
|
|
||
|
instance.save()
|
||
|
shadow.delete()
|
||
|
except ShadowCall.DoesNotExist:
|
||
|
pass
|