mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-06 06:12:26 +00:00
Add model to store reading progress.
This commit is contained in:
parent
b2ccf22191
commit
60f0aa207d
2 changed files with 46 additions and 0 deletions
31
fedireads/migrations/0031_readthrough.py
Normal file
31
fedireads/migrations/0031_readthrough.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
# Generated by Django 3.0.3 on 2020-04-15 12:24
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fedireads', '0030_quotation'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ReadThrough',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('created_date', models.DateTimeField(auto_now_add=True)),
|
||||
('updated_date', models.DateTimeField(auto_now=True)),
|
||||
('pages_read', models.IntegerField(blank=True, null=True)),
|
||||
('start_date', models.DateTimeField(blank=True, null=True)),
|
||||
('finish_date', models.DateTimeField(blank=True, null=True)),
|
||||
('book', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fedireads.Book')),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'abstract': False,
|
||||
},
|
||||
),
|
||||
]
|
|
@ -134,6 +134,21 @@ class Tag(FedireadsModel):
|
|||
unique_together = ('user', 'book', 'name')
|
||||
|
||||
|
||||
class ReadThrough(FedireadsModel):
|
||||
''' Store progress through a book in the database. '''
|
||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||
book = models.ForeignKey('Book', on_delete=models.PROTECT)
|
||||
pages_read = models.IntegerField(
|
||||
null=True,
|
||||
blank=True)
|
||||
start_date = models.DateTimeField(
|
||||
blank=True,
|
||||
null=True)
|
||||
finish_date = models.DateTimeField(
|
||||
blank=True,
|
||||
null=True)
|
||||
|
||||
|
||||
NotificationType = models.TextChoices(
|
||||
'NotificationType', 'FAVORITE REPLY TAG FOLLOW FOLLOW_REQUEST BOOST')
|
||||
|
||||
|
|
Loading…
Reference in a new issue