Ejemplo n.º 1
0
 def save_edit(
     self,
     user={},
     note="",
     edit_type="",
     old_value=None,
     new_value=None,
     newprovisionalvalue=None,
     oldprovisionalvalue=None,
     provisional_edit_log_details=None,
 ):
     timestamp = datetime.datetime.now()
     edit = EditLog()
     edit.resourceclassid = self.resourceinstance.graph_id
     edit.resourceinstanceid = self.resourceinstance.resourceinstanceid
     edit.nodegroupid = self.nodegroup_id
     edit.tileinstanceid = self.tileid
     if provisional_edit_log_details is not None:
         edit.provisional_user_username = getattr(provisional_edit_log_details["provisional_editor"], "username", "")
         edit.provisional_userid = getattr(provisional_edit_log_details["provisional_editor"], "id", "")
         edit.provisional_edittype = provisional_edit_log_details["action"]
         user = provisional_edit_log_details["user"]
     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.user_username = getattr(user, "username", "")
     edit.resourcedisplayname = Resource.objects.get(resourceinstanceid=self.resourceinstance.resourceinstanceid).displayname
     edit.oldvalue = old_value
     edit.newvalue = new_value
     edit.timestamp = timestamp
     edit.edittype = edit_type
     edit.newprovisionalvalue = newprovisionalvalue
     edit.oldprovisionalvalue = oldprovisionalvalue
     edit.save()
Ejemplo n.º 2
0
Archivo: tile.py Proyecto: mrcnc/arches
 def save_edit(self,
               user={},
               note='',
               edit_type='',
               old_value=None,
               new_value=None,
               newprovisionalvalue=None,
               oldprovisionalvalue=None):
     timestamp = datetime.datetime.now()
     edit = EditLog()
     edit.resourceclassid = self.resourceinstance.graph_id
     edit.resourceinstanceid = self.resourceinstance.resourceinstanceid
     edit.nodegroupid = self.nodegroup_id
     edit.tileinstanceid = self.tileid
     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.user_username = getattr(user, 'username', '')
     edit.resourcedisplayname = Resource.objects.get(
         resourceinstanceid=self.resourceinstance.resourceinstanceid
     ).displayname
     edit.oldvalue = old_value
     edit.newvalue = new_value
     edit.timestamp = timestamp
     edit.edittype = edit_type
     edit.newprovisionalvalue = newprovisionalvalue
     edit.oldprovisionalvalue = oldprovisionalvalue
     edit.save()