Refactoring
* adds simple getter methods for UserActionLogEntry * replaces manual creation of UserActionLogEntry with new methods
This commit is contained in:
12
ema/forms.py
12
ema/forms.py
@@ -16,7 +16,7 @@ from compensation.forms.forms import AbstractCompensationForm, CompensationRespo
|
||||
from ema.models import Ema, EmaDocument
|
||||
from intervention.models import Responsibility
|
||||
from konova.forms import SimpleGeomForm, NewDocumentForm
|
||||
from user.models import UserActionLogEntry, UserAction
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
@@ -59,10 +59,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin):
|
||||
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)
|
||||
|
||||
@@ -130,10 +127,7 @@ class EditEmaForm(NewEmaForm):
|
||||
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)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ from ema.models import Ema
|
||||
from intervention.models import Responsibility
|
||||
from konova.models import Geometry
|
||||
from konova.settings import DEFAULT_GROUP, ETS_GROUP
|
||||
from user.models import UserActionLogEntry, UserAction
|
||||
from user.models import UserActionLogEntry
|
||||
|
||||
|
||||
class EmaViewTestCase(CompensationViewTestCase):
|
||||
@@ -61,10 +61,7 @@ class EmaViewTestCase(CompensationViewTestCase):
|
||||
def create_dummy_data(cls):
|
||||
# Create dummy data
|
||||
# Create log entry
|
||||
action = UserActionLogEntry.objects.create(
|
||||
user=cls.superuser,
|
||||
action=UserAction.CREATED,
|
||||
)
|
||||
action = UserActionLogEntry.get_created_action(cls.superuser)
|
||||
# Create responsible data object
|
||||
responsibility_data = Responsibility.objects.create()
|
||||
geometry = Geometry.objects.create()
|
||||
|
||||
Reference in New Issue
Block a user