Changes between Version 19 and Version 20 of AuditTrail


Ignore:
Timestamp:
02/02/2010 07:08:48 AM (5 years ago)
Author:
stodge
Comment:

Added code borrowed from the Basie project (please check license) to fix the foreign key clash described in the caveat.

Legend:

Unmodified
Added
Removed
Modified
  • AuditTrail

    v19 v20  
    299299            attrs[field.name].primary_key = False
    300300
     301            # Rebuild and replace the 'rel' object to avoid foreign key clashes.
     302            # Borrowed from the Basie project - please check if adding this is allowed by the license.
     303            if isinstance(field, models.ForeignKey):
     304                rel = copy.copy(field.rel)
     305                rel.related_name = '_audit_' + field.related_query_name()
     306                attrs[field.name].rel = rel
     307
    301308    for track_field in _track_fields(kwargs['track_fields']):
    302309        if track_field['name'] in attrs:
Back to Top