Merge pull request '249_Last_modified_created' (#250) from 249_Last_modified_created into master
Reviewed-on: SGD-Nord/konova#250
This commit is contained in:
commit
e30f625497
@ -64,6 +64,7 @@ class CompensationAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensa
|
|||||||
obj = Compensation()
|
obj = Compensation()
|
||||||
created = create_action
|
created = create_action
|
||||||
obj.created = created
|
obj.created = created
|
||||||
|
obj.modified = created
|
||||||
obj.geometry = geometry
|
obj.geometry = geometry
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ class EcoAccountAPISerializerV1(AbstractModelAPISerializerV1,
|
|||||||
obj.legal = Legal()
|
obj.legal = Legal()
|
||||||
created = create_action
|
created = create_action
|
||||||
obj.created = created
|
obj.created = created
|
||||||
|
obj.modified = created
|
||||||
obj.geometry = geometry
|
obj.geometry = geometry
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ class EmaAPISerializerV1(AbstractModelAPISerializerV1, AbstractCompensationAPISe
|
|||||||
)
|
)
|
||||||
created = create_action
|
created = create_action
|
||||||
obj.created = created
|
obj.created = created
|
||||||
|
obj.modified = created
|
||||||
obj.geometry = geometry
|
obj.geometry = geometry
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
@ -76,6 +76,7 @@ class InterventionAPISerializerV1(AbstractModelAPISerializerV1,
|
|||||||
created = create_action
|
created = create_action
|
||||||
obj.legal = legal
|
obj.legal = legal
|
||||||
obj.created = created
|
obj.created = created
|
||||||
|
obj.modified = created
|
||||||
obj.geometry = geometry
|
obj.geometry = geometry
|
||||||
obj.responsible = resp
|
obj.responsible = resp
|
||||||
return obj
|
return obj
|
||||||
|
@ -156,6 +156,7 @@ class NewCompensationForm(AbstractCompensationForm,
|
|||||||
title=title,
|
title=title,
|
||||||
intervention=intervention,
|
intervention=intervention,
|
||||||
created=action,
|
created=action,
|
||||||
|
modified=action,
|
||||||
is_cef=is_cef,
|
is_cef=is_cef,
|
||||||
is_coherence_keeping=is_coherence_keeping,
|
is_coherence_keeping=is_coherence_keeping,
|
||||||
is_pik=is_pik,
|
is_pik=is_pik,
|
||||||
|
@ -117,6 +117,7 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
|||||||
responsible=responsible,
|
responsible=responsible,
|
||||||
deductable_surface=surface,
|
deductable_surface=surface,
|
||||||
created=action,
|
created=action,
|
||||||
|
modified=action,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
is_pik=is_pik,
|
is_pik=is_pik,
|
||||||
legal=legal
|
legal=legal
|
||||||
|
@ -71,6 +71,7 @@ class CompensationWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(new_compensation.title, test_title)
|
self.assertEqual(new_compensation.title, test_title)
|
||||||
self.assert_equal_geometries(new_compensation.geometry.geom, test_geom)
|
self.assert_equal_geometries(new_compensation.geometry.geom, test_geom)
|
||||||
self.assertEqual(new_compensation.log.count(), 1)
|
self.assertEqual(new_compensation.log.count(), 1)
|
||||||
|
self.assertEqual(new_compensation.created, new_compensation.modified)
|
||||||
|
|
||||||
# Expect logs to be set
|
# Expect logs to be set
|
||||||
self.assertEqual(pre_creation_intervention_log_count + 1, self.intervention.log.count())
|
self.assertEqual(pre_creation_intervention_log_count + 1, self.intervention.log.count())
|
||||||
|
@ -65,6 +65,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(acc.deductable_rest, test_deductable_surface)
|
self.assertEqual(acc.deductable_rest, test_deductable_surface)
|
||||||
self.assert_equal_geometries(acc.geometry.geom, test_geom)
|
self.assert_equal_geometries(acc.geometry.geom, test_geom)
|
||||||
self.assertEqual(acc.log.count(), 1)
|
self.assertEqual(acc.log.count(), 1)
|
||||||
|
self.assertEqual(acc.created, acc.modified)
|
||||||
|
|
||||||
# Expect logs to be set
|
# Expect logs to be set
|
||||||
self.assertEqual(acc.log.count(), 1)
|
self.assertEqual(acc.log.count(), 1)
|
||||||
|
@ -46,6 +46,8 @@ def index_view(request: HttpRequest):
|
|||||||
compensations = Compensation.objects.filter(
|
compensations = Compensation.objects.filter(
|
||||||
deleted=None, # only show those which are not deleted individually
|
deleted=None, # only show those which are not deleted individually
|
||||||
intervention__deleted=None, # and don't show the ones whose intervention has been deleted
|
intervention__deleted=None, # and don't show the ones whose intervention has been deleted
|
||||||
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
)
|
)
|
||||||
table = CompensationTable(
|
table = CompensationTable(
|
||||||
request=request,
|
request=request,
|
||||||
|
@ -41,6 +41,8 @@ def index_view(request: HttpRequest):
|
|||||||
template = "generic_index.html"
|
template = "generic_index.html"
|
||||||
eco_accounts = EcoAccount.objects.filter(
|
eco_accounts = EcoAccount.objects.filter(
|
||||||
deleted=None,
|
deleted=None,
|
||||||
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
)
|
)
|
||||||
table = EcoAccountTable(
|
table = EcoAccountTable(
|
||||||
request=request,
|
request=request,
|
||||||
|
@ -81,6 +81,7 @@ class NewEmaForm(AbstractCompensationForm, CompensationResponsibleFormMixin, Pik
|
|||||||
title=title,
|
title=title,
|
||||||
responsible=responsible,
|
responsible=responsible,
|
||||||
created=action,
|
created=action,
|
||||||
|
modified=action,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
is_pik=is_pik,
|
is_pik=is_pik,
|
||||||
)
|
)
|
||||||
|
@ -62,6 +62,7 @@ class EmaWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(ema.title, test_title)
|
self.assertEqual(ema.title, test_title)
|
||||||
self.assert_equal_geometries(ema.geometry.geom, test_geom)
|
self.assert_equal_geometries(ema.geometry.geom, test_geom)
|
||||||
self.assertEqual(ema.log.count(), 1)
|
self.assertEqual(ema.log.count(), 1)
|
||||||
|
self.assertEqual(ema.created, ema.modified)
|
||||||
|
|
||||||
# Expect logs to be set
|
# Expect logs to be set
|
||||||
self.assertEqual(ema.log.count(), 1)
|
self.assertEqual(ema.log.count(), 1)
|
||||||
|
@ -39,6 +39,8 @@ def index_view(request: HttpRequest):
|
|||||||
template = "generic_index.html"
|
template = "generic_index.html"
|
||||||
emas = Ema.objects.filter(
|
emas = Ema.objects.filter(
|
||||||
deleted=None,
|
deleted=None,
|
||||||
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
)
|
)
|
||||||
|
|
||||||
table = EmaTable(
|
table = EmaTable(
|
||||||
|
@ -270,6 +270,7 @@ class NewInterventionForm(BaseForm):
|
|||||||
responsible=responsibility_data,
|
responsible=responsibility_data,
|
||||||
legal=legal_data,
|
legal=legal_data,
|
||||||
created=action,
|
created=action,
|
||||||
|
modified=action,
|
||||||
comment=comment,
|
comment=comment,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -78,6 +78,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
|||||||
self.assertEqual(1, obj.log.count())
|
self.assertEqual(1, obj.log.count())
|
||||||
self.assertEqual(obj.log.first().action, UserAction.CREATED)
|
self.assertEqual(obj.log.first().action, UserAction.CREATED)
|
||||||
self.assertEqual(obj.log.first().user, self.superuser)
|
self.assertEqual(obj.log.first().user, self.superuser)
|
||||||
|
self.assertEqual(obj.created, obj.modified)
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
# Fail if there is no such object
|
# Fail if there is no such object
|
||||||
self.fail()
|
self.fail()
|
||||||
|
@ -45,6 +45,8 @@ def index_view(request: HttpRequest):
|
|||||||
deleted=None, # not deleted
|
deleted=None, # not deleted
|
||||||
).select_related(
|
).select_related(
|
||||||
"legal"
|
"legal"
|
||||||
|
).order_by(
|
||||||
|
"-modified__timestamp"
|
||||||
)
|
)
|
||||||
table = InterventionTable(
|
table = InterventionTable(
|
||||||
request=request,
|
request=request,
|
||||||
|
Loading…
Reference in New Issue
Block a user