renaming to property

This commit is contained in:
Thomas Nahuel Rusiecki 2024-11-13 21:05:54 -03:00 committed by Cayo Puigdefabregas
parent 1254c727dc
commit 8dfe52c2c0
6 changed files with 13 additions and 13 deletions

View file

@ -99,7 +99,7 @@ class SearchView(InventaryMixin):
qry |= Q(value__startswith=i)
chids = SystemProperty.objects.filter(
type=Annotation.Type.SYSTEM,
type=Property.Type.SYSTEM,
owner=self.request.user.institution
).filter(
qry

View file

@ -59,7 +59,7 @@ class BaseDeviceFormSet(forms.BaseFormSet):
path_name = save_in_disk(doc, self.user.institution.name, place="placeholder")
create_index(doc, self.user)
create_annotation(doc, user, commit=commit)
create_property(doc, user, commit=commit)
move_json(path_name, self.user.institution.name, place="placeholder")
return doc

View file

@ -146,7 +146,7 @@ class Device:
def get_unassigned(cls, institution, offset=0, limit=None):
sql = """
WITH RankedAnnotations AS (
WITH RankedProperties AS (
SELECT
t1.value,
t1.key,
@ -159,7 +159,7 @@ class Device:
ELSE 3
END,
t1.created DESC
) AS row_num
) AS row_num
FROM evidence_systemproperty AS t1
LEFT JOIN lot_devicelot AS t2 ON t1.value = t2.device_id
WHERE t2.device_id IS NULL
@ -169,7 +169,7 @@ class Device:
SELECT DISTINCT
value
FROM
RankedAnnotations
RankedProperties
WHERE
row_num = 1
""".format(
@ -269,7 +269,7 @@ class Device:
cursor.execute(sql)
properties = cursor.fetchall()
return cls(id=annotations[0][0])
return cls(id=properties[0][0])
@property
def is_websnapshot(self):

View file

@ -187,17 +187,17 @@ class AddUserPropertyView(DashboardView, CreateView):
form.instance.owner = self.request.user.institution
form.instance.user = self.request.user
form.instance.uuid = self.annotation.uuid
form.instance.type = Annotation.Type.USER
form.instance.type = Property.Type.USER
response = super().form_valid(form)
return response
def get_form_kwargs(self):
pk = self.kwargs.get('pk')
institution = self.request.user.institution
self.annotation = Annotation.objects.filter(
self.annotation = SystemProperty.objects.filter(
owner=institution,
value=pk,
type=Annotation.Type.SYSTEM
type=Property.Type.SYSTEM
).first()
if not self.annotation:
@ -230,7 +230,7 @@ class AddDocumentView(DashboardView, CreateView):
self.annotation = SystemProperty.objects.filter(
owner=institution,
value=pk,
type=Annotation.Type.SYSTEM
type=Property.Type.SYSTEM
).first()
if not self.annotation:

View file

@ -164,7 +164,7 @@ class ImportForm(forms.Form):
table = []
for row in self.rows:
doc = create_doc(row)
annotation = create_annotation(doc, self.user)
annotation = create_property(doc, self.user)
table.append((doc, annotation))
if commit:
@ -222,7 +222,7 @@ class EraseServerForm(forms.Form):
if self.instance:
return
Annotation.objects.create(
SystemProperty.objects.create(
uuid=self.uuid,
type=Annotation.Type.ERASE_SERVER,
key='ERASE_SERVER',

View file

@ -70,7 +70,7 @@ class Command(BaseCommand):
def build_placeholder(self, s, user, f_path):
try:
create_index(s, user)
create_annotation(s, user, commit=True)
create_property(s, user, commit=True)
except Exception as err:
txt = "In placeholder %s \n%s"
logger.warning(txt, f_path, err)