Commits

Rajesh Pappula  committed f0e6219 Draft

updated models.py
added serialize to primary key field
update post save function to work with load data

  • Participants
  • Parent commits afbe9c7

Comments (0)

Files changed (1)

File simple_history/models.py

                 field.primary_key = False
                 field._unique = False
                 field.db_index = True
+                field.serialize = True
             if fk:
                 field.name = field.name + "_id"
             fields[field.name] = field
     def post_save(self, instance, created, **kwargs):
         if not created and hasattr(instance, 'skip_history_when_saving'):
             return
-        self.create_historical_record(instance, created and '+' or '~')
+        if not kwargs.get('raw', False):
+            self.create_historical_record(instance, created and '+' or '~')
 
     def post_delete(self, instance, **kwargs):
         self.create_historical_record(instance, '-')