del index on seat name

ues create_datetime to sort
This commit is contained in:
David 2019-05-29 12:28:28 +08:00
parent a6773358f5
commit 14d0055ba8
3 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 2.2.1 on 2019-05-29 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('booking', '0004_auto_20190527_1455'),
]
operations = [
migrations.AlterField(
model_name='seat',
name='name',
field=models.CharField(blank=True, max_length=128, verbose_name='名称'),
),
]

View File

@ -40,7 +40,7 @@ class Room(models.Model):
class Seat(models.Model):
id = models.CharField('ID', max_length=36, default=uuid.uuid1, primary_key=True)
name = models.CharField('名称', max_length=128, blank=True, db_index=True)
name = models.CharField('名称', max_length=128, blank=True)
room = models.ForeignKey(verbose_name='房间', to=Room, on_delete=models.CASCADE)
created_datetime = models.DateTimeField('创建时间', auto_now_add=True)

View File

@ -252,7 +252,7 @@ class RoomBookingStatusDetail(generics.GenericAPIView):
count_total = 0
booked_count_total = 0
seat_list = []
for seat in room.seat_set.all().order_by('name'):
for seat in room.seat_set.all().order_by('created_datetime'):
# 初始化数组
step = datetime.timedelta(minutes=setting.booking_interval)
booking_status_list = []