summaryrefslogtreecommitdiff
path: root/lib/python2.7/site-packages/south/introspection_plugins/django_audit_log.py
blob: b874428e6dc4353c0b120d2aadca50f918006796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""                                                 
South introspection rules for django-audit-log
"""                                                 
                                                    
from django.contrib.auth.models import User
from django.conf import settings
from south.modelsinspector import add_introspection_rules

if "audit_log" in settings.INSTALLED_APPS:
    try:                                                
        # Try and import the field so we can see if audit_log is available
        from audit_log.models import fields

        # Make sure the `to` and `null` parameters will be ignored
        rules = [(                                     
            (fields.LastUserField,),                   
            [],                                        
            {                                          
                'to': ['rel.to', {'default': User}],   
                'null': ['null', {'default': True}],   
            },                                         
        )]                                             

        # Add the rules for the `LastUserField`
        add_introspection_rules(                           
            rules,                                         
            ['^audit_log\.models\.fields\.LastUserField'], 
        )                                                  
    except ImportError:                                 
        pass