Fakultas Ilmu Komputer UI

Commit 62feec58 authored by Luthfi Dzaky Saifuddin's avatar Luthfi Dzaky Saifuddin
Browse files

readme md

parent 592dd2c8
Pipeline #26473 passed with stages
in 8 minutes and 26 seconds
......@@ -537,7 +537,26 @@ slug = models.SlugField(blank=True)
Kemudian migrasi seperti berikut untuk melakukan backfill pada 100 data yang sudah ada:
from django.db import migrations
from django.utils.text import slugify
def slugify(apps, schema_editor):
List = apps.get_model("lists", "List")
for list_ in List.objects.all():
items = list_.item_set.all()
for ix, item in enumerate(items):
item.slug = slugify(item.text)
class Migration(migrations.Migration):
dependencies = [
('lists', '0007_item_slug'),
operations = [
Eksekusi migrasi bisa dilakukan dengan menggunakan scheduler,
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