def save_edit(self, user={}, note="", edit_type=""): timestamp = datetime.datetime.now() edit = EditLog() edit.resourceclassid = self.graph_id edit.resourceinstanceid = self.resourceinstanceid edit.userid = getattr(user, "id", "") edit.user_email = getattr(user, "email", "") edit.user_firstname = getattr(user, "first_name", "") edit.user_lastname = getattr(user, "last_name", "") edit.note = note edit.timestamp = timestamp edit.edittype = edit_type edit.save()
def save_edit(self, user={}, note='', edit_type=''): timestamp = datetime.datetime.now() edit = EditLog() edit.resourceclassid = self.graph_id edit.resourceinstanceid = self.resourceinstanceid edit.userid = getattr(user, 'id', '') edit.user_email = getattr(user, 'email', '') edit.user_firstname = getattr(user, 'first_name', '') edit.user_lastname = getattr(user, 'last_name', '') edit.note = note edit.timestamp = timestamp edit.edittype = edit_type edit.save()
def setUp(self): self.expected_resource_count = 2 self.client = Client() self.data_type_graphid = "330802c5-95bd-11e8-b7ac-acde48001122" self.resource_instance_id = "f562c2fa-48d3-4798-a723-10209806c068" user = User.objects.get(username="******") edit_records = EditLog.objects.filter( resourceinstanceid=self.resource_instance_id).filter( edittype="created") if len(edit_records) == 0: edit = EditLog(userid=user.id, edittype="create", resourceinstanceid=self.resource_instance_id) edit.save()