Added timestamp fields for motions.

This commit is contained in:
Norman Jäckel 2019-01-19 10:27:50 +01:00
parent cb3e6c4e47
commit b15a57bbdd
4 changed files with 38 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Motions:
- Added new permission to create amendments [#4128].
- Added multi select action to manage submitters, tags, states and
recommendations [#4037, #4132].
- Added timestampes for motions [#4134].
User:
- Added new admin group which grants all permissions. Users of existing group

View File

@ -0,0 +1,25 @@
# Generated by Django 2.1.5 on 2019-01-19 09:25
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('motions', '0018_auto_20190118_2101'),
]
operations = [
migrations.AddField(
model_name='motion',
name='created',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
migrations.AddField(
model_name='motion',
name='last_modified',
field=models.DateTimeField(auto_now=True),
),
]

View File

@ -244,6 +244,16 @@ class Motion(RESTModelMixin, models.Model):
Users who support this motion.
"""
created = models.DateTimeField(auto_now_add=True)
"""
Timestamp when motion is created.
"""
last_modified = models.DateTimeField(auto_now=True)
"""
Timestamp when motion is modified.
"""
# In theory there could be one then more agenda_item. But we support only
# one. See the property agenda_item.
agenda_items = GenericRelation(Item, related_name="motions")

View File

@ -434,6 +434,8 @@ class MotionSerializer(ModelSerializer):
"log_messages",
"sort_parent",
"weight",
"created",
"last_modified",
)
read_only_fields = (
"state",