Example #1
0
 def log_change(
     self,
     request,
     obj,
     message,
     ):
     fullhistory.adjust_history(obj, 'U')
 def test_m2m_adjustments(self):
     fullhistory.end_session()
     t1a = Test1Model(field1="test")
     t1a.save()
     t3 = Test3Model(field1="testa", field2=5)
     t3.save()
     t3.test1_m2m.add(t1a)
     history = fullhistory.adjust_history(t3)
     self.assertNotEqual(None, history)
     self.assertTrue('test1_m2m' in history.data)
     self.assertEqual(1, len(history.data['test1_m2m']))
     self.assertEqual(history.data['test1_m2m'][0], [t1a.pk])
     fullhistory.end_session()
     t1b = Test1Model(field1="testb")
     t1b.save()
     t3.test1_m2m.add(t1b)
     history = fullhistory.adjust_history(t3)
     self.assertEqual(history.data['test1_m2m'][0], [t1a.pk])
     self.assertTrue(t1a.pk in history.data['test1_m2m'][1] and t1b.pk in history.data['test1_m2m'][1])
     self.assertEqual(2, len(FullHistory.objects.actions_for_object(t3)))
 def test_m2m_adjustments(self):
     fullhistory.end_session()
     t1a = Test1Model(field1="test")
     t1a.save()
     t3 = Test3Model(field1="testa", field2=5)
     t3.save()
     t3.test1_m2m.add(t1a)
     history = fullhistory.adjust_history(t3)
     self.assertNotEqual(None, history)
     self.assertTrue('test1_m2m' in history.data)
     self.assertEqual(1, len(history.data['test1_m2m']))
     self.assertEqual(history.data['test1_m2m'][0], [t1a.pk])
     fullhistory.end_session()
     t1b = Test1Model(field1="testb")
     t1b.save()
     t3.test1_m2m.add(t1b)
     history = fullhistory.adjust_history(t3)
     self.assertEqual(history.data['test1_m2m'][0], [t1a.pk])
     self.assertTrue(t1a.pk in history.data['test1_m2m'][1]
                     and t1b.pk in history.data['test1_m2m'][1])
     self.assertEqual(2, len(FullHistory.objects.actions_for_object(t3)))
Example #4
0
 def log_change(self, request, obj, message):
     fullhistory.adjust_history(obj, 'U')
Example #5
0
 def log_addition(self, request, obj):
     fullhistory.adjust_history(obj, 'A')