rename main code directory
This commit is contained in:
parent
b42faad556
commit
f77c156733
199 changed files with 0 additions and 0 deletions
32
bookwyrm/migrations/0005_auto_20200221_1645.py
Normal file
32
bookwyrm/migrations/0005_auto_20200221_1645.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
# Generated by Django 3.0.3 on 2020-02-21 16:45
|
||||
import re
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def populate_identifiers(app_registry, schema_editor):
|
||||
db_alias = schema_editor.connection.alias
|
||||
tags = app_registry.get_model('fedireads', 'Tag')
|
||||
for tag in tags.objects.using(db_alias):
|
||||
tag.identifier = re.sub(r'\W+', '-', tag.name).lower()
|
||||
tag.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('fedireads', '0004_tag'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='tag',
|
||||
name='identifier',
|
||||
field=models.CharField(max_length=100, null=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='tag',
|
||||
name='name',
|
||||
field=models.CharField(max_length=100),
|
||||
),
|
||||
migrations.RunPython(populate_identifiers),
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue