Used the same timestamp for multiple history objects.
This commit is contained in:
parent
1cdeb3bcb8
commit
de7b531933
18
openslides/core/migrations/0011_auto_20190119_0958.py
Normal file
18
openslides/core/migrations/0011_auto_20190119_0958.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 2.1.5 on 2019-01-19 08:58
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('core', '0010_auto_20190118_1908'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='history',
|
||||||
|
name='now',
|
||||||
|
field=models.DateTimeField(),
|
||||||
|
),
|
||||||
|
]
|
@ -266,6 +266,7 @@ class HistoryManager(models.Manager):
|
|||||||
"""
|
"""
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
instances = []
|
instances = []
|
||||||
|
history_time = now()
|
||||||
for element in elements:
|
for element in elements:
|
||||||
if (
|
if (
|
||||||
element["disable_history"]
|
element["disable_history"]
|
||||||
@ -280,6 +281,7 @@ class HistoryManager(models.Manager):
|
|||||||
element_id=get_element_id(
|
element_id=get_element_id(
|
||||||
element["collection_string"], element["id"]
|
element["collection_string"], element["id"]
|
||||||
),
|
),
|
||||||
|
now=history_time,
|
||||||
information=element["information"],
|
information=element["information"],
|
||||||
user_id=element["user_id"],
|
user_id=element["user_id"],
|
||||||
full_data=data,
|
full_data=data,
|
||||||
@ -329,7 +331,7 @@ class History(RESTModelMixin, models.Model):
|
|||||||
|
|
||||||
element_id = models.CharField(max_length=255)
|
element_id = models.CharField(max_length=255)
|
||||||
|
|
||||||
now = models.DateTimeField(auto_now_add=True)
|
now = models.DateTimeField()
|
||||||
|
|
||||||
information = models.CharField(max_length=255)
|
information = models.CharField(max_length=255)
|
||||||
|
|
||||||
|
@ -176,3 +176,4 @@ class HistorySerializer(ModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = History
|
model = History
|
||||||
fields = ("id", "element_id", "now", "information", "user")
|
fields = ("id", "element_id", "now", "information", "user")
|
||||||
|
read_only_fields = ("now",)
|
||||||
|
@ -568,7 +568,7 @@ class MotionViewSet(ModelViewSet):
|
|||||||
person=request.user,
|
person=request.user,
|
||||||
skip_autoupdate=True,
|
skip_autoupdate=True,
|
||||||
)
|
)
|
||||||
inform_changed_data(motion, information=f"State set to {motion.state.name}.")
|
inform_changed_data(motion, information=f"State set to {motion.state.name}.", user_id=request.user.pk)
|
||||||
return Response({"detail": message})
|
return Response({"detail": message})
|
||||||
|
|
||||||
@detail_route(methods=["put"])
|
@detail_route(methods=["put"])
|
||||||
|
Loading…
Reference in New Issue
Block a user