Browse Source

Arruma mensagem de aviso

Signed-off-by: Luciano Almeida <lucianoalmeida@interlegis.leg.br>
pull/261/head
Luciano Almeida 9 years ago
parent
commit
7260cfe2f4
  1. 9
      legacy/migration.py
  2. 16
      parlamentares/migrations/0013_merge.py

9
legacy/migration.py

@ -160,8 +160,6 @@ class DataMigrator:
for field in new._meta.fields:
old_field_name = renames.get(field.name)
field_type = field.get_internal_type()
msg = 'Field %s (%s) from model %s' % (
field.name, field_type, field.model.__name__)
if old_field_name:
old_value = getattr(old, old_field_name)
@ -177,8 +175,11 @@ class DataMigrator:
value = getattr(old, old_field_name)
if field_type == 'CharField' or field_type == 'TextField':
if value is None:
warn(msg +
" => settig empty string '' for %s value" % value)
warn(
"Field %s (%s) from model %s"
" => settig empty string '' for %s value" %
(field.name, field_type, field.model.__name__,
value))
value = ''
setattr(new, field.name, value)

16
parlamentares/migrations/0013_merge.py

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-03-10 17:06
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('parlamentares', '0012_parlamentar_unidade_deliberativa'),
('parlamentares', '0012_auto_20160307_0905'),
]
operations = [
]
Loading…
Cancel
Save