コード例 #1
0
ファイル: handlers.py プロジェクト: das-10/django-dynamo
def field_pre_delete(sender, **kwargs):
    '''
    A signal handler to run any pre delete activities and trigger the built-in
    pre delete signals
    1. Trigger the pre delete signal
    '''
    MetaField=sender
    meta_field=kwargs['instance']
    pre_field_delete.send(sender=meta_field.meta_model.get_model(),field=meta_field)
コード例 #2
0
ファイル: handlers.py プロジェクト: das-10/django-dynamo
def model_pre_delete(sender, **kwargs):
    '''
    A signal handler to run any model pre delete activities and trigger the built-in
    pre delete signals
    1. Delete the table in db, if settings require us to do so
    2. Trigger the pre delete signal
    '''
    
    MetaModel=sender
    meta_model=kwargs['instance']
    DynamicModel = meta_model.get_model()

    if DYNAMO_DELETE_TABLES:
        utils.delete_db_table(DynamicModel)


    # trigger pre field delete signal
    pre_field_delete.send(sender=MetaModel,old_model=DynamicModel)
    meta_model._delete=DynamicModel