mirror of
https://github.com/ajurna/cbwebreader.git
synced 2025-12-06 06:17:17 +00:00
change the comic list view to use a datatable.
This commit is contained in:
20
comic/migrations/0013_comicstatus_finished.py
Normal file
20
comic/migrations/0013_comicstatus_finished.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.2 on 2016-04-04 11:28
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('comic', '0012_auto_20160401_0949'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='comicstatus',
|
||||
name='finished',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
||||
26
comic/migrations/0014_auto_20160404_1402.py
Normal file
26
comic/migrations/0014_auto_20160404_1402.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.2 on 2016-04-04 13:02
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.models import Max
|
||||
|
||||
def set_finished(apps, schema_editor):
|
||||
comicstatus = apps.get_model('comic', 'comicstatus')
|
||||
comicpage = apps.get_model('comic', 'ComicPage')
|
||||
for row in comicstatus.objects.all():
|
||||
last_page = comicpage.objects.filter(Comic=row.comic).aggregate(Max('index'))
|
||||
if row.last_read_page == last_page['index__max']:
|
||||
row.finished = True
|
||||
row.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('comic', '0013_comicstatus_finished'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(set_finished, reverse_code=migrations.RunPython.noop),
|
||||
]
|
||||
Reference in New Issue
Block a user