Merge pull request #4134 from normanjaeckel/MotionCreatedTimestamp

Added timestamp fields for motions.
This commit is contained in:
Oskar Hahn 2019-01-19 14:23:21 +01:00 committed by GitHub
commit 27cb63174e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Motions:
- Added new permission to create amendments [#4128]. - Added new permission to create amendments [#4128].
- Added multi select action to manage submitters, tags, states and - Added multi select action to manage submitters, tags, states and
recommendations [#4037, #4132]. recommendations [#4037, #4132].
- Added timestampes for motions [#4134].
User: User:
- Added new admin group which grants all permissions. Users of existing group - 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. 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 # In theory there could be one then more agenda_item. But we support only
# one. See the property agenda_item. # one. See the property agenda_item.
agenda_items = GenericRelation(Item, related_name="motions") agenda_items = GenericRelation(Item, related_name="motions")

View File

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