Fakultas Ilmu Komputer UI

Commit 20022472 authored by Rani Lasma Uli's avatar Rani Lasma Uli
Browse files

add migration

parent 59021c39
Pipeline #27139 failed with stages
in 1 minute and 28 seconds
# -*- coding: utf-8 -*-
# Generated by Django 1.11.24 on 2019-12-10 16:01
from __future__ import unicode_literals
from django.db import migrations
def find_dupes(apps, schema_editor):
List = apps.get_model("lists", "List")
for list_ in List.objects.all():
items = list_.item_set.all()
texts = set()
for ix, item in enumerate(items):
if item.text in texts:
item.text = '{} ({})'.format(item.text, ix)
item.save()
texts.add(item.text)
class Migration(migrations.Migration):
dependencies = [
('lists', '0003_auto_20191121_1714'),
]
operations = [
migrations.RunPython(find_dupes),
]
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment