diff --git a/dashboard/views.py b/dashboard/views.py index 6c6f87a..4917bb8 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -6,7 +6,7 @@ from django.shortcuts import Http404 from django.db.models import Q from dashboard.mixins import InventaryMixin, DetailsMixin -from evidence.models import Property, SystemProperty +from evidence.models import SystemProperty from evidence.xapian import search from device.models import Device from lot.models import Lot @@ -100,7 +100,6 @@ class SearchView(InventaryMixin): qry |= Q(value__startswith=i) chids = SystemProperty.objects.filter( - type=Property.Type.SYSTEM, owner=self.request.user.institution ).filter( qry diff --git a/device/views.py b/device/views.py index a0c537a..e61de24 100644 --- a/device/views.py +++ b/device/views.py @@ -15,7 +15,7 @@ from django.views.generic.edit import ( from django.views.generic.base import TemplateView from action.models import StateDefinition, State from dashboard.mixins import DashboardView, Http403 -from evidence.models import UserProperty, SystemProperty, Property +from evidence.models import UserProperty, SystemProperty from lot.models import LotTag from device.models import Device from device.forms import DeviceFormSet @@ -198,7 +198,7 @@ class AddUserPropertyView(DashboardView, CreateView): form.instance.owner = self.request.user.institution form.instance.user = self.request.user form.instance.uuid = self.property.uuid - form.instance.type = Property.Type.USER + form.instance.type = UserProperty.Type.USER messages.success(self.request, _("User property successfully added.")) @@ -215,7 +215,6 @@ class AddUserPropertyView(DashboardView, CreateView): self.property = SystemProperty.objects.filter( owner=institution, value=pk, - type=Property.Type.SYSTEM ).first() if not self.property: @@ -251,7 +250,7 @@ class UpdateUserPropertyView(DashboardView, UpdateView): form.instance.owner = self.request.user.institution form.instance.user = self.request.user - form.instance.type = Property.Type.USER + form.instance.type = UserProperty.Type.USER response = super().form_valid(form) messages.success(self.request, _("User property updated successfully.")) @@ -292,14 +291,14 @@ class AddDocumentView(DashboardView, CreateView): title = _("New Document") breadcrumb = "Device / New document" success_url = reverse_lazy('dashboard:unassigned_devices') - model = SystemProperty + model = UserProperty fields = ("key", "value") def form_valid(self, form): form.instance.owner = self.request.user.institution form.instance.user = self.request.user form.instance.uuid = self.property.uuid - form.instance.type = Property.Type.DOCUMENT + form.instance.type = UserProperty.Type.DOCUMENT response = super().form_valid(form) return response @@ -309,7 +308,6 @@ class AddDocumentView(DashboardView, CreateView): self.property = SystemProperty.objects.filter( owner=institution, value=pk, - type=Property.Type.SYSTEM ).first() if not self.property: diff --git a/evidence/views.py b/evidence/views.py index 54e1687..56333b8 100644 --- a/evidence/views.py +++ b/evidence/views.py @@ -13,7 +13,7 @@ from django.views.generic.edit import ( ) from dashboard.mixins import DashboardView, Http403 -from evidence.models import Property, SystemProperty, UserProperty, Evidence +from evidence.models import SystemProperty, UserProperty, Evidence from evidence.forms import ( UploadForm, UserTagForm, diff --git a/lot/views.py b/lot/views.py index 36f582f..9ff0227 100644 --- a/lot/views.py +++ b/lot/views.py @@ -11,7 +11,6 @@ from django.views.generic.edit import ( from dashboard.mixins import DashboardView from lot.models import Lot, LotTag, LotProperty from lot.forms import LotsForm -from device.models import Property class NewLotView(DashboardView, CreateView): template_name = "new_lot.html" @@ -154,7 +153,7 @@ class LotAddDocumentView(DashboardView, CreateView): form.instance.owner = self.request.user.institution form.instance.user = self.request.user form.instance.lot = self.lot - form.instance.type = Property.Type.DOCUMENT + form.instance.type = LotProperty.Type.DOCUMENT response = super().form_valid(form) return response @@ -178,7 +177,7 @@ class LotDocumentsView(DashboardView, TemplateView): documents = LotProperty.objects.filter( lot=lot, owner=self.request.user.institution, - type=Property.Type.DOCUMENT, + type=LotProperty.Type.DOCUMENT, ) context.update({ 'lot': lot, @@ -201,7 +200,7 @@ class LotPropertiesView(DashboardView, TemplateView): properties = LotProperty.objects.filter( lot=lot, owner=self.request.user.institution, - type=Property.Type.USER, + type=LotProperty.Type.USER, ) context.update({ 'lot': lot, @@ -224,7 +223,7 @@ class LotAddPropertyView(DashboardView, CreateView): form.instance.owner = self.request.user.institution form.instance.user = self.request.user form.instance.lot = self.lot - form.instance.type = Property.Type.USER + form.instance.type = LotProperty.Type.USER response = super().form_valid(form) return response