From 04099d31a6eea30e72fdfc5e46a6d80c9b21a3bc Mon Sep 17 00:00:00 2001 From: Thomas Rusiecki Date: Fri, 15 Nov 2024 18:15:44 -0300 Subject: [PATCH] model constraints changed and moved url to /device --- evidence/models.py | 15 +++++++++++---- evidence/urls.py | 1 - 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/evidence/models.py b/evidence/models.py index 4074b7c..4574f64 100644 --- a/evidence/models.py +++ b/evidence/models.py @@ -28,10 +28,7 @@ class Property(models.Model): value = models.CharField(max_length=STR_EXTEND_SIZE) class Meta: - constraints = [ - models.UniqueConstraint( - fields=["type", "key", "uuid"], name="unique_type_key_uuid") - ] + #Only for shared behaviour, it is not a table abstract = True class SystemProperty(Property): @@ -43,6 +40,12 @@ class SystemProperty(Property): name='property_cannot_be_user' ), ] + #Django orm wont inherit constraints to child + #TODO: check if this is needed + constraints = [ + models.UniqueConstraint( + fields=["type", "key", "uuid"], name="system_unique_type_key_uuid") + ] class UserProperty(Property): @@ -55,6 +58,10 @@ class UserProperty(Property): name='property_needs_to_be_user' ), ] + constraints = [ + models.UniqueConstraint( + fields=["type", "key", "uuid"], name="user_unique_type_key_uuid") + ] diff --git a/evidence/urls.py b/evidence/urls.py index 501e867..0d03f61 100644 --- a/evidence/urls.py +++ b/evidence/urls.py @@ -20,5 +20,4 @@ urlpatterns = [ path("", views.EvidenceView.as_view(), name="details"), path("/eraseserver", views.EraseServerView.as_view(), name="erase_server"), path("/download", views.DownloadEvidenceView.as_view(), name="download"), - path('user_property//del', views.UserPropertyDeleteView.as_view(), name='delete_user_property'), ]