Refactoring
* adds simple getter methods for UserActionLogEntry * replaces manual creation of UserActionLogEntry with new methods
This commit is contained in:
@@ -18,7 +18,7 @@ from compensation.models import Compensation, EcoAccount
|
||||
from intervention.inputs import GenerateInput
|
||||
from intervention.models import Intervention, Responsibility, Legal
|
||||
from konova.forms import BaseForm, SimpleGeomForm
|
||||
from user.models import UserActionLogEntry, UserAction
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class AbstractCompensationForm(BaseForm):
|
||||
@@ -210,10 +210,7 @@ class NewCompensationForm(AbstractCompensationForm, CEFCompensationFormMixin, Co
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.CREATED,
|
||||
)
|
||||
action = UserActionLogEntry.get_created_action(user)
|
||||
# Process the geometry form
|
||||
geometry = geom_form.save(action)
|
||||
|
||||
@@ -270,10 +267,7 @@ class EditCompensationForm(NewCompensationForm):
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.EDITED,
|
||||
)
|
||||
action = UserActionLogEntry.get_edited_action(user)
|
||||
|
||||
# Process the geometry form
|
||||
geometry = geom_form.save(action)
|
||||
@@ -364,10 +358,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.CREATED,
|
||||
)
|
||||
action = UserActionLogEntry.get_created_action(user)
|
||||
# Process the geometry form
|
||||
geometry = geom_form.save(action)
|
||||
|
||||
@@ -444,10 +435,8 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
||||
comment = self.cleaned_data.get("comment", None)
|
||||
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=user,
|
||||
action=UserAction.EDITED,
|
||||
)
|
||||
action = UserActionLogEntry.get_edited_action(user)
|
||||
|
||||
# Process the geometry form
|
||||
geometry = geom_form.save(action)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user