This fixes Javascript widgets working with DocAliases, such as the replaces field in draft submission, to work better with Javascript disabled. It also makes sense from a modelling perspective as the name really is a unique key for the alias. The actual transformation requires a series of migrations taking a couple of minutes to complete. The actual switch to the key is done at the end. Branch ready for merge. - Legacy-Id: 10111
23 lines
649 B
Python
23 lines
649 B
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import migrations
|
|
import django.db
|
|
|
|
def fill_in_docalias_relationship_names(apps, schema_editor):
|
|
with django.db.connection.cursor() as cursor:
|
|
cursor.execute("update ipr_iprdocrel join doc_docalias on doc_docalias.id = ipr_iprdocrel.document_id set ipr_iprdocrel.document_name = doc_docalias.name;")
|
|
|
|
def noop(apps, schema_editor):
|
|
pass
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('ipr', '0004_iprdocrel_document_name'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(fill_in_docalias_relationship_names, noop)
|
|
]
|