Browse Source

Tratamento de exceção para permitir que o codigo seja carregado sem o banco criado

producao
Marcio Mazza 10 years ago
parent
commit
7a7e26cb4a
  1. 4
      sigi/apps/diagnosticos/admin.py

4
sigi/apps/diagnosticos/admin.py

@ -5,7 +5,7 @@ from eav.admin import BaseEntityAdmin, BaseSchemaAdmin
from sigi.apps.diagnosticos.models import Diagnostico, Pergunta, Escolha, Equipe, Anexo, Categoria from sigi.apps.diagnosticos.models import Diagnostico, Pergunta, Escolha, Equipe, Anexo, Categoria
from sigi.apps.diagnosticos.forms import DiagnosticoForm from sigi.apps.diagnosticos.forms import DiagnosticoForm
from sigi.apps.contatos.models import UnidadeFederativa from sigi.apps.contatos.models import UnidadeFederativa
from django.db.utils import OperationalError from django.db.utils import OperationalError, ProgrammingError
def publicar_diagnostico(self, request, queryset): def publicar_diagnostico(self, request, queryset):
@ -79,6 +79,8 @@ class DiagnosticoAdmin(BaseEntityAdmin):
}),) }),)
except OperationalError: except OperationalError:
pass # Hack to prevent Django.db.OperationalError on migrate/syncdb at creating new database pass # Hack to prevent Django.db.OperationalError on migrate/syncdb at creating new database
except ProgrammingError:
pass # Hack to prevent Django.db.OperationalError on migrate/syncdb at creating new database
def get_uf(self, obj): def get_uf(self, obj):
return '%s' % (obj.casa_legislativa.municipio.uf) return '%s' % (obj.casa_legislativa.municipio.uf)

Loading…
Cancel
Save