# -*- coding: utf-8 -*-
# Copyright (C) 2018 Freetech Solutions

# This file is part of OMniLeads

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3, as published by
# the Free Software Foundation.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see http://www.gnu.org/licenses/.
#
# Generated by Django 1.9.7 on 2018-01-09 21:06
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations


def adicionar_calificacion_especial_campanas(apps, schema_editor):
    """
    Adiciona NombreCalificacion correspondiente a la Agenda.
    """
    NombreCalificacion = apps.get_model("ominicontacto_app", "NombreCalificacion")

    calificacion_agenda, _ = NombreCalificacion.objects.get_or_create(
        nombre=settings.CALIFICACION_REAGENDA)


def rollback(apps, schema_editor):
    """
    Vuelve hacia la atrás los cambios de la migración de datos especificada en la función
    'adicionar_calificacion_especial_campanas'
    """
    NombreCalificacion = apps.get_model("ominicontacto_app", "NombreCalificacion")
    NombreCalificacion.objects.get(nombre=settings.CALIFICACION_REAGENDA).delete()


class Migration(migrations.Migration):

    dependencies = [
        ('ominicontacto_app', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(adicionar_calificacion_especial_campanas, rollback),
    ]
