Esempio n. 1
0
File: views.py Progetto: avpakh/new
def showtypes(request,pk):

    table = AvTable(Av.objects.all().filter(id_station=pk))

    stations=Station.objects.all()

    visiblestations=Station.objects.all().filter(id_station=pk)

    last_date=Av.objects.first()

    tableav=True

    RequestConfig(request,paginate={"per_page":10}).configure(table)

    return render(request,'table.html',{'table':table,'stations':stations,'tableav':tableav,'name':visiblestations,'ld':last_date},)


     #init_Tables10(request)# Create a tables from databases
    dat10 = Av.objects.all()
    if dat10.count()>0:
        Av.objects.all().delete()

    stations_id=[4,7] # list of id_stations
    for idsta in stations_id:
        row10=getdata_table10(idsta)
        for rowdata in row10:
            datatableav10=Av()
            datatableav10.value_min=rowdata[2]
            datatableav10.value_avg=rowdata[1]
            datatableav10.value_max=rowdata[3]
            datatableav10.date_observation=rowdata[0]
            datatableav10.id_station=idsta
            datatableav10.save()

    return datatableav10
Esempio n. 2
0
File: views.py Progetto: avpakh/new
def init_Tables10(request):

# Create a tables from databases
    dat10 = Av.objects.all()
    if dat10.count()>0:
        Av.objects.all().delete()

    stations_id=[4,7] # list of id_stations
    for idsta in stations_id:
        row10=getdata_table10(idsta)
        for rowdata in row10:
            datatableav10=Av()
            datatableav10.value_min=rowdata[2]
            datatableav10.value_avg=rowdata[1]
            datatableav10.value_max=rowdata[3]
            datatableav10.date_observation=rowdata[0]
            datatableav10.id_station=idsta
            datatableav10.save()

    return datatableav10