How to show an alert in python? [closed]

1

I want to validate a date range and if it's wrong, show an alert to the user, but I do not know how to do it, I'm working on the filter.py what I have is the following:

        if fecha2 <= fecha1:
            print "fecha incorrecta"

        if fecha1 != "None" and fecha2 != "None":
            fecha1 = datetime.datetime.strptime(fecha1, "%Y-%m-%d").strftime("%d %b %Y")
            fecha1 = fecha1.upper()
            fecha2 = datetime.datetime.strptime(fecha2, "%Y-%m-%d").strftime("%d %b %Y")
            fecha2 = fecha2.upper()
            TopDescarga.objects.all().delete()
            cursor = connection.cursor()
            cursor.execute("INSERT INTO comportamiento_topdescarga(imsi_pref_top,operador_top,descarga_top) select imsi_pref,nomb_oper,round(avg(descarga)::numeric,3) from comportamiento_trafico_de_datos WHERE fecha BETWEEN '%"+ fecha1 +"%' AND '%"+ fecha2 +"%' group by nomb_oper,imsi_pref order by avg(descarga) desc ")


        elif fecha1 != "None":
            fecha1 = datetime.datetime.strptime(fecha1, "%Y-%m-%d").strftime("%d %b %Y")
            fecha1 = fecha1.upper()

            TopDescarga.objects.all().delete()
            cursor = connection.cursor()
            cursor.execute("INSERT INTO comportamiento_topdescarga(imsi_pref_top,operador_top,descarga_top) select imsi_pref,nomb_oper,round(avg(descarga)::numeric,3) from comportamiento_trafico_de_datos WHERE fecha like '%"+ fecha1 +"%' group by nomb_oper,imsi_pref order by avg(descarga) desc")
    
asked by Coloma 08.06.2016 в 23:45
source

0 answers