# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-06 13:02
from __future__ import unicode_literals

from django.db import migrations


def convert_lines_data(apps, schema_editor):
    CartLine = apps.get_model('cart', 'CartLine')
    # Iterate over all cart lines, due to wrong JSONField None handling
    for line in CartLine.objects.all():
        if line.data is None:
            line.data = {}
            line.save(update_fields=['data'])


class Migration(migrations.Migration):

    dependencies = [
        ('cart', '0002_auto_20161014_1221'),
    ]

    operations = [
        migrations.RunPython(convert_lines_data)
    ]

Add cart lines data migration
Add cart lines data migration
