# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-25 10:20
from __future__ import unicode_literals

from django.db import migrations, models


def prepopulate_vendor_slugs(apps, schema_editor):
    from pcart_core.utils import get_unique_slug
    Vendor = apps.get_model('pcart_catalog', 'Vendor')
    for vendor in Vendor.objects.all():
        vendor.slug = get_unique_slug(vendor.title, Vendor)
        vendor.save()


class Migration(migrations.Migration):

    dependencies = [
        ('pcart_catalog', '0015_vendor_slug'),
    ]

    operations = [
        migrations.RunPython(prepopulate_vendor_slugs),
    ]
