Ticket #693 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Introspection plugin for Django Audit Log

Reported by: Rick.van.Hattem@… Owned by: andrew
Priority: major Milestone: 1.0
Component: commands Version: unknown
Keywords: Cc:

Description

Since this came by at a StackOverflow? question I thought it might be nice to add the introspection plugin to South :)

Django Audit Log uses a custom field to store the current user, it's trivial to implement but might confuse some users.

Link to the field: http://code.google.com/p/django-audit-log/source/browse/audit_log/models/fields.py

The StackOverflow? question: http://stackoverflow.com/questions/4475377/django-south-with-django-audit-log/

The proposed plugin:

"""                                                 
South introspection rules for django-audit-log
"""                                                 
                                                    
from south.modelsinspector import add_introspection_rules
                                                    
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

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone set to 1.0

Fixed in [abd220673d79].

Note: See TracTickets for help on using tickets.