forked from enviPath/enviPy
27 lines
673 B
Python
27 lines
673 B
Python
# Generated by Django 5.2.7 on 2025-11-11 14:13
|
|
|
|
import re
|
|
|
|
from django.db import migrations
|
|
|
|
|
|
def set_cc(apps, schema_editor):
|
|
License = apps.get_model("epdb", "License")
|
|
for license in License.objects.all():
|
|
pattern = r"/licenses/([^/]+)/4\.0"
|
|
match = re.search(pattern, license.link)
|
|
if match:
|
|
license.cc_string = match.group(1)
|
|
license.save()
|
|
else:
|
|
print(f"Could not find license for {license.link}")
|
|
raise ValueError()
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("epdb", "0010_license_cc_string"),
|
|
]
|
|
|
|
operations = [migrations.RunPython(set_cc)]
|