renaming of annotation to property
This commit is contained in:
parent
e93cccaf2d
commit
aff13a04eb
|
@ -180,7 +180,7 @@ class AddUserPropertyView(DashboardView, CreateView):
|
|||
def form_valid(self, form):
|
||||
form.instance.owner = self.request.user.institution
|
||||
form.instance.user = self.request.user
|
||||
form.instance.uuid = self.annotation.uuid
|
||||
form.instance.uuid = self.property.uuid
|
||||
form.instance.type = Property.Type.USER
|
||||
response = super().form_valid(form)
|
||||
return response
|
||||
|
@ -188,13 +188,13 @@ class AddUserPropertyView(DashboardView, CreateView):
|
|||
def get_form_kwargs(self):
|
||||
pk = self.kwargs.get('pk')
|
||||
institution = self.request.user.institution
|
||||
self.annotation = SystemProperty.objects.filter(
|
||||
self.property = UserProperty.objects.filter(
|
||||
owner=institution,
|
||||
value=pk,
|
||||
type=Property.Type.SYSTEM
|
||||
).first()
|
||||
|
||||
if not self.annotation:
|
||||
if not self.property:
|
||||
raise Http404
|
||||
|
||||
self.success_url = reverse_lazy('device:details', args=[pk])
|
||||
|
@ -211,13 +211,8 @@ class UpdateUserPropertyView(DashboardView, UpdateView):
|
|||
def get_form_kwargs(self):
|
||||
pk = self.kwargs.get('pk')
|
||||
user_property = get_object_or_404(UserProperty, pk=pk, owner=self.request.user.institution)
|
||||
self.property = SystemProperty.objects.filter(
|
||||
owner=self.request.user.institution,
|
||||
uuid=user_property.uuid,
|
||||
type=Property.Type.SYSTEM
|
||||
).first()
|
||||
|
||||
if not self.property:
|
||||
|
||||
if not user_property:
|
||||
raise Http404
|
||||
|
||||
kwargs = super().get_form_kwargs()
|
||||
|
@ -225,7 +220,7 @@ class UpdateUserPropertyView(DashboardView, UpdateView):
|
|||
return kwargs
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.owner = self.request .user.institution
|
||||
form.instance.owner = self.request .user.institution
|
||||
form.instance.user = self.request.user
|
||||
form.instance.type = Property.Type.USER
|
||||
response = super().form_valid(form)
|
||||
|
@ -263,7 +258,7 @@ class DeleteUserPropertyView(DashboardView, DeleteView):
|
|||
|
||||
|
||||
class AddDocumentView(DashboardView, CreateView):
|
||||
template_name = "new_annotation.html"
|
||||
template_name = "new_user_property.html"
|
||||
title = _("New Document")
|
||||
breadcrumb = "Device / New document"
|
||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
||||
|
@ -273,7 +268,7 @@ class AddDocumentView(DashboardView, CreateView):
|
|||
def form_valid(self, form):
|
||||
form.instance.owner = self.request.user.institution
|
||||
form.instance.user = self.request.user
|
||||
form.instance.uuid = self.annotation.uuid
|
||||
form.instance.uuid = self.property.uuid
|
||||
form.instance.type = Property.Type.DOCUMENT
|
||||
response = super().form_valid(form)
|
||||
return response
|
||||
|
@ -281,13 +276,13 @@ class AddDocumentView(DashboardView, CreateView):
|
|||
def get_form_kwargs(self):
|
||||
pk = self.kwargs.get('pk')
|
||||
institution = self.request.user.institution
|
||||
self.annotation = SystemProperty.objects.filter(
|
||||
self.property = SystemProperty.objects.filter(
|
||||
owner=institution,
|
||||
value=pk,
|
||||
type=Property.Type.SYSTEM
|
||||
).first()
|
||||
|
||||
if not self.annotation:
|
||||
if not self.property:
|
||||
raise Http404
|
||||
|
||||
self.success_url = reverse_lazy('device:details', args=[pk])
|
||||
|
|
|
@ -164,8 +164,8 @@ class ImportForm(forms.Form):
|
|||
table = []
|
||||
for row in self.rows:
|
||||
doc = create_doc(row)
|
||||
annotation = create_property(doc, self.user)
|
||||
table.append((doc, annotation))
|
||||
property = create_property(doc, self.user)
|
||||
table.append((doc, property))
|
||||
|
||||
if commit:
|
||||
for doc, cred in table:
|
||||
|
|
Loading…
Reference in New Issue