# -*- coding: utf-8 -*- # Generated by Django 1.9.3 on 2016-03-03 10:57 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): """Empty floatfield are stored as empty string by sqlite. But Django hates that and refuse to handle it properly until they are stored as NULL.""" dependencies = [ ('contribmap', '0001_initial'), ] float_cols = ['bandwidth', 'share_part', 'floor', 'floor_total'] operations = [ migrations.RunSQL( "UPDATE contribs SET {col}=NULL WHERE {col}='';".format(col=i)) for i in float_cols ]