43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
|
|
# Generated by Django 6.1 on 2026-10-04 19:28
|
||
|
|
|
||
|
|
from django.db import migrations, models
|
||
|
|
|
||
|
|
|
||
|
|
def count_words(apps, schema_editor):
|
||
|
|
"""The reading time of the articles already there."""
|
||
|
|
from feeds.fetch import word_count
|
||
|
|
Item = apps.get_model('feeds', 'Item')
|
||
|
|
for item in Item.objects.exclude(content='').only('id', 'content').iterator():
|
||
|
|
Item.objects.filter(pk=item.pk).update(words=word_count(item.content))
|
||
|
|
|
||
|
|
|
||
|
|
class Migration(migrations.Migration):
|
||
|
|
|
||
|
|
dependencies = [
|
||
|
|
('feeds', '0002_item_paywalled_sitelogin'),
|
||
|
|
]
|
||
|
|
|
||
|
|
operations = [
|
||
|
|
migrations.AddField(
|
||
|
|
model_name='item',
|
||
|
|
name='words',
|
||
|
|
field=models.PositiveIntegerField(default=0),
|
||
|
|
),
|
||
|
|
migrations.AddField(
|
||
|
|
model_name='source',
|
||
|
|
name='fav',
|
||
|
|
field=models.BooleanField(default=False),
|
||
|
|
),
|
||
|
|
migrations.AddField(
|
||
|
|
model_name='source',
|
||
|
|
name='hidden',
|
||
|
|
field=models.BooleanField(default=False),
|
||
|
|
),
|
||
|
|
migrations.AddField(
|
||
|
|
model_name='source',
|
||
|
|
name='notify',
|
||
|
|
field=models.BooleanField(default=False),
|
||
|
|
),
|
||
|
|
migrations.RunPython(count_words, migrations.RunPython.noop),
|
||
|
|
]
|