Created|Deleted refactoring
* refactors base attributes created and deleted into UserActionLogEntry foreign keys * refactors all related queries and process logic * fixes binding_on into binding_date in intervention/detail/view.html * adds basic __str__ for some models *
This commit is contained in:
@@ -15,10 +15,12 @@ from django.urls import reverse
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from intervention.models import Intervention
|
||||
from konova.enums import UserActionLogEntryEnum
|
||||
from konova.forms import BaseForm, BaseModalForm
|
||||
from konova.models import Document
|
||||
from konova.settings import DEFAULT_LAT, DEFAULT_LON, DEFAULT_ZOOM
|
||||
from organisation.models import Organisation
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class NewInterventionForm(BaseForm):
|
||||
@@ -115,6 +117,10 @@ class NewInterventionForm(BaseForm):
|
||||
geometry = self.cleaned_data.get("geometry", Polygon())
|
||||
documents = self.cleaned_data.get("documents", []) or []
|
||||
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserActionLogEntryEnum.CREATED.value,
|
||||
)
|
||||
intervention = Intervention(
|
||||
identifier=identifier,
|
||||
title=title,
|
||||
@@ -124,7 +130,7 @@ class NewInterventionForm(BaseForm):
|
||||
data_provider=data_provider,
|
||||
data_provider_detail=data_provider_detail,
|
||||
geometry=geometry,
|
||||
created_by=user,
|
||||
created=action,
|
||||
)
|
||||
intervention.save()
|
||||
for doc in documents:
|
||||
|
||||
Reference in New Issue
Block a user