WIP: rework/properties #31

Draft
rskthomas wants to merge 19 commits from rework/properties into main
1 changed files with 9 additions and 9 deletions
Showing only changes of commit b7d7b9041d - Show all commits

View File

@ -8,7 +8,7 @@ from utils.device import create_property, create_doc, create_index
from utils.forms import MultipleFileField from utils.forms import MultipleFileField
from device.models import Device from device.models import Device
from evidence.parse import Build from evidence.parse import Build
from evidence.models import SystemProperty from evidence.models import SystemProperty, Property
from utils.save_snapshots import move_json, save_in_disk from utils.save_snapshots import move_json, save_in_disk
@ -68,9 +68,9 @@ class UserTagForm(forms.Form):
self.pk = None self.pk = None
self.uuid = kwargs.pop('uuid', None) self.uuid = kwargs.pop('uuid', None)
self.user = kwargs.pop('user') self.user = kwargs.pop('user')
instance = Annotation.objects.filter( instance = SystemProperty.objects.filter(
uuid=self.uuid, uuid=self.uuid,
type=Annotation.Type.SYSTEM, type=Property.Type.SYSTEM,
key='CUSTOM_ID', key='CUSTOM_ID',
owner=self.user.institution owner=self.user.institution
).first() ).first()
@ -88,7 +88,7 @@ class UserTagForm(forms.Form):
self.tag = data self.tag = data
self.instance = SystemProperty.objects.filter( self.instance = SystemProperty.objects.filter(
uuid=self.uuid, uuid=self.uuid,
type=Annotation.Type.SYSTEM, type=Property.Type.SYSTEM,
key='CUSTOM_ID', key='CUSTOM_ID',
owner=self.user.institution owner=self.user.institution
).first() ).first()
@ -186,9 +186,9 @@ class EraseServerForm(forms.Form):
self.pk = None self.pk = None
self.uuid = kwargs.pop('uuid', None) self.uuid = kwargs.pop('uuid', None)
self.user = kwargs.pop('user') self.user = kwargs.pop('user')
instance = Annotation.objects.filter( instance = SystemProperty.objects.filter(
uuid=self.uuid, uuid=self.uuid,
type=Annotation.Type.ERASE_SERVER, type=SystemProperty.Type.ERASE_SERVER,
key='ERASE_SERVER', key='ERASE_SERVER',
owner=self.user.institution owner=self.user.institution
).first() ).first()
@ -201,9 +201,9 @@ class EraseServerForm(forms.Form):
def clean(self): def clean(self):
self.erase_server = self.cleaned_data.get('erase_server', False) self.erase_server = self.cleaned_data.get('erase_server', False)
self.instance = Annotation.objects.filter( self.instance = SystemProperty.objects.filter(
uuid=self.uuid, uuid=self.uuid,
type=Annotation.Type.ERASE_SERVER, type=Property.Type.ERASE_SERVER,
key='ERASE_SERVER', key='ERASE_SERVER',
owner=self.user.institution owner=self.user.institution
).first() ).first()
@ -224,7 +224,7 @@ class EraseServerForm(forms.Form):
SystemProperty.objects.create( SystemProperty.objects.create(
uuid=self.uuid, uuid=self.uuid,
type=Annotation.Type.ERASE_SERVER, type=Property.Type.ERASE_SERVER,
key='ERASE_SERVER', key='ERASE_SERVER',
value=self.erase_server, value=self.erase_server,
owner=self.user.institution, owner=self.user.institution,