mirror of https://github.com/doccano/doccano.git
pythonannotation-tooldatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learning
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
495 B
19 lines
495 B
import os
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def store_filename(apps, schema_editor):
|
|
Example = apps.get_model("examples", "Example")
|
|
for example in Example.objects.all():
|
|
example.upload_name = os.path.basename(example.filename.name)
|
|
example.save()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("examples", "0004_example_upload_name"),
|
|
]
|
|
|
|
operations = [migrations.RunPython(code=store_filename, reverse_code=migrations.RunPython.noop)]
|