Renamed some datetime fields from 'time' to 'modified', to match their semantics, and changed them to use auto_now=True. This should fix an issue with outdated timestamps on some meeting-related objects.
- Legacy-Id: 14724
This commit is contained in:
parent
5573dc00d0
commit
91ee536322
35
ietf/meeting/migrations/0003_rename_modified_fields.py
Normal file
35
ietf/meeting/migrations/0003_rename_modified_fields.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.10 on 2018-03-02 14:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('meeting', '0002_auto_20180225_1207'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='floorplan',
|
||||
old_name='time',
|
||||
new_name='modified',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='room',
|
||||
old_name='time',
|
||||
new_name='modified',
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='floorplan',
|
||||
name='modified',
|
||||
field=models.DateTimeField(auto_now=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='room',
|
||||
name='modified',
|
||||
field=models.DateTimeField(auto_now=True),
|
||||
),
|
||||
]
|
|
@ -302,7 +302,7 @@ class ResourceAssociation(models.Model):
|
|||
|
||||
class Room(models.Model):
|
||||
meeting = ForeignKey(Meeting)
|
||||
time = models.DateTimeField(default=datetime.datetime.now)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
name = models.CharField(max_length=255)
|
||||
functional_name = models.CharField(max_length=255, blank = True)
|
||||
capacity = models.IntegerField(null=True, blank=True)
|
||||
|
@ -392,7 +392,7 @@ def floorplan_path(instance, filename):
|
|||
class FloorPlan(models.Model):
|
||||
name = models.CharField(max_length=255)
|
||||
short = models.CharField(max_length=3, default='')
|
||||
time = models.DateTimeField(default=datetime.datetime.now)
|
||||
modified= models.DateTimeField(auto_now=True)
|
||||
meeting = ForeignKey(Meeting)
|
||||
order = models.SmallIntegerField()
|
||||
image = models.ImageField(storage=NoLocationMigrationFileSystemStorage(), upload_to=floorplan_path, blank=True, default=None)
|
||||
|
|
|
@ -964,10 +964,10 @@ def json_agenda(request, num=None ):
|
|||
if room.x1 is not None:
|
||||
roomdict['x'] = (room.x1+room.x2)/2.0
|
||||
roomdict['y'] = (room.y1+room.y2)/2.0
|
||||
roomdict['modified'] = room.time
|
||||
roomdict['modified'] = room.modified
|
||||
if room.floorplan and room.floorplan.image:
|
||||
roomdict['map'] = room.floorplan.image.url
|
||||
roomdict['modified'] = max(room.time,room.floorplan.time)
|
||||
roomdict['modified'] = max(room.modified, room.floorplan.modified)
|
||||
rooms.append(roomdict)
|
||||
|
||||
parents = []
|
||||
|
|
Loading…
Reference in a new issue