From d96559c2cc38dbbe6d07c8c19034b58beedc82ff Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Fri, 24 May 2013 15:14:19 +1000 Subject: [PATCH] More basic layout stuff --- SprinklerStudio/db/development.db | Bin 147456 -> 147456 bytes SprinklerStudio/settings.py | 1 + SprinklerStudio/settings.pyc | Bin 3358 -> 3375 bytes SprinklerStudio/templates/index.html | 10 +++++---- SprinklerStudio/urls.py | 1 + SprinklerStudio/urls.pyc | Bin 680 -> 727 bytes setup/__init__.pyc | Bin 0 -> 170 bytes setup/models.pyc | Bin 0 -> 755 bytes setup/templates/setup/index.html | 32 +++++++++++++++++++++++++++ setup/urls.py | 8 +++++++ setup/urls.pyc | Bin 0 -> 387 bytes setup/views.py | 30 +++++++++++++++++++++++++ setup/views.pyc | Bin 0 -> 1408 bytes sprinklers/models.py | 1 + sprinklers/models.pyc | Bin 1182 -> 1215 bytes 15 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 setup/__init__.pyc create mode 100644 setup/models.pyc create mode 100644 setup/urls.py create mode 100644 setup/urls.pyc create mode 100644 setup/views.pyc diff --git a/SprinklerStudio/db/development.db b/SprinklerStudio/db/development.db index ace3c0a5de75c743446d593b5da1f471fd26998c..8ad8cd28bb8336a8f1cabe07d44c72f243ee64e4 100644 GIT binary patch delta 1591 zcmaKqUuYCZ9LIN()63lL?)Ppt$sH}FXG{f)S!ZTvW_Pa-#g{(WU?_d^MJ=Jk6kB7^ z2a$`45Ai|UhH`>furH<1(wd_^N($|Zg;uC76iNmA2N4xfp(4drXm|I;oRj2XJ`Z2! zGr#Z7&fFZGo12cJVW^xnSKO zrxzwFozgLEDAtrB$G5d_FOs`YZE1{59e8>7f!WEKk;c@%*~!-@XBy+LZr{GS{qO?0 zSx8TP*uB0;o_$8vOC1Z};a%*+sC&oly1U)yo%_yL&IxDSso8(nAK5eZ3wD3`QhA}g zv%Il%yVU7SR1TL~x=yWalvKy4BNz|Im>Ltj!9_FVO%?~CNEG9g>sQ{Inc6q~M%v)b zJ$ol#o7J^7JRWEnrN>dO3~#u{Yb_hdno0&*MLK4bOG6y$5qmrt2P%>g7nFyFH@Jo; zT0s;E%{Ar15dGD~PzR9;Wt4i{@VqrV9>g*cEcICKwU%9}s^%ihU%{F}2cgy?QZ#vT zo~o>&u^B8Y|5 zVY~V}8En}r?#wqz6(llZGNi`)Q03LNFbNVNm1NX-9;)=D*8Sls(S5Rxc?*y5H~zvM z+{88fhF|eBF5`P##5Y*N7r20r@gY9IIh?@)PGP=NWfOR*&`(J{LoLH_hM^3D8T<@h zhH8dN24rwEI2r5=<@V)!M5QhETeyl}@GlX|8cLoKe|h4iv_pkSBlni0|VB;<7dRR4>MH0YlhNy z%rNwAGZcQ=47uMbnJM#V(c0MCDe(rwULnsmEdOxn^&1<* L?v<^5n=1bU$4G0y delta 324 zcmZo@;B08%oFFY2!@$6x0>nx{%m~D)6LpLkV;U2-CNM5s&ju6_W&AmveFLK=3)4f! z{>^~`v5cBb-r}ytjE&}*c`2zC#RWx~dD%IsMaA(s`RS>7B}J9-X%+DYA>3nld)?Pye`q@!j^Dn;ErbB)E9@ zFz}z`pTr-{ufq41Z#!QipBC?D-aVTI4Hocj-*cDIgGqvm|2zZ#AO7$BpZMSMzu}DQnVP%G8q|wC`FqgMTfyGMHh(mAcD*cDf$d424KN- zpbDUHiXlUa5s)$lViUM3V+N2kkPlU#%FU2s3gnpqu{ncTlsZESBSWwTqwVIejEpRt ztUw1BrrkW+ZF9_t#OAZ{Q(hzCUQZr;y%m5H%q@>HJ8$$xm1 E02nPbiU0rr delta 215 zcmZ24HBU;2`7 {% if sprinkler_list %} {% for sprinkler in sprinkler_list %} - + {% if sprinkler.enabled %} + + {% endif %} {% endfor %} {% else %}

No active sprinklers were found.

diff --git a/SprinklerStudio/urls.py b/SprinklerStudio/urls.py index ae8cf17..3bd244d 100644 --- a/SprinklerStudio/urls.py +++ b/SprinklerStudio/urls.py @@ -17,5 +17,6 @@ urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^weather/', include('weather.urls')), url(r'^sprinklers/', include('sprinklers.urls')), + url(r'^setup/', include('setup.urls')), url(r'^$', views.index, name='index') ) diff --git a/SprinklerStudio/urls.pyc b/SprinklerStudio/urls.pyc index 47f2e71a7b3f2079c6044b89ee90aac132b4d5e6..c0a2d371fded5c08f352b390f9ec1734f3b201af 100644 GIT binary patch delta 133 zcmZ3%dYx68`7-aAY(HdLlh4~3O_@zhQP$*i$vLhI^&8{OG*p$i@89ifS8+;84Vf5gn(Qb SW&uV4MlL2cP6#~`F$qZ1y1*9E-xOn+Q=}A)T3|ZU^DL}--(9Fcx%*qhO!;r$u j5UjyB@#dn<(-^fGMFfC~WtasR1sJ)Q*f=E^g@6zMT@VlO diff --git a/setup/__init__.pyc b/setup/__init__.pyc new file mode 100644 index 0000000000000000000000000000000000000000..cf92d4cc99454be6689014180b9ba6bf381e1ba8 GIT binary patch literal 170 zcmZSn%*!=5e0E?m0~9ayu6h2N%fv%ev(%vCAkQbPyX+x8c06{Y@$W0XDL+Z@2qu7<`HM|9nxd+%j zyGSi?jgx%w`OfkA_2}=%>6e?QtD2tI2>TOR<*GTvuNCrR1p6)--D=xH~nT8-BJ8&8d}Nou0&FjkS$t2*I$f zkdCZ|3k3FuAo_u8)hiF*)|{zMdH?w}{abaMf}{<&D~Q>(x4z}eQOx_R5{LwsYb~y@BHgjQc*?N-4{c0YD8=B`n0Vd)Q&ny8ZGjWlQ!NuBT nTbafl%iDFQ!VNeNmmwbC + + +
@@ -10,6 +22,26 @@
+ +
+

Sprinklers

+
+ {% if sprinklers %} + {% for sprinkler in sprinklers %} +
+

{{sprinkler.id}}

+

+ Name:
+ Enabled:
+ Master valve: (Will turn on when any other sprinkler is on) +

+
+ {% endfor %} + {% else %} +

No active sprinklers were found.

+ {% endif %} +
+

Finding location...

diff --git a/setup/urls.py b/setup/urls.py new file mode 100644 index 0000000..adb06a3 --- /dev/null +++ b/setup/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import patterns, url + +from setup import views + +urlpatterns = patterns('', + # ex: /setup/ + url(r'^$', views.index, name='index'), +) diff --git a/setup/urls.pyc b/setup/urls.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d0b2e6f09b3a4a486792dcda502d2f395405256e GIT binary patch literal 387 zcmYLEOHRZv40X~@2Z4}g#R*t+)m#7}7VMB<25$QsUvdfupgT_0 z17RRFczRaXzMCw%NNUZTcdb$D;0NrOX~xjI7lYvtHF46tSMyMnwyDOC`MVd^>&f6{ N+KUQ?Gr5w5`~j>hRy_a! literal 0 HcmV?d00001 diff --git a/setup/views.py b/setup/views.py index 60f00ef..e575ea5 100644 --- a/setup/views.py +++ b/setup/views.py @@ -1 +1,31 @@ # Create your views here. +import json +import urllib2 +from django.core.cache import cache +from django.http import HttpResponse +from weather.models import Location +from django.template import Context, loader + +from weather import WeatherUtils +from sprinklers.models import Sprinkler + +def index(request): + #cache.clear() + latitude = Location.objects.all()[0].latitude + longitude = Location.objects.all()[0].longitude + + sprinklers = Sprinkler.objects.all() + + template = loader.get_template('setup/index.html') + context = Context({ + 'sprinklers': sprinklers, + }) + return HttpResponse(template.render(context)) + +def ajax(request): + + latitude = request.GET['lat'] # request.POST.get('lat', False) + longitude = request.GET['lon'] # request.POST.get('lat', False) + + temperature = WeatherUtils.currentTempByLatLon(latitude, longitude) + return HttpResponse(temperature) diff --git a/setup/views.pyc b/setup/views.pyc new file mode 100644 index 0000000000000000000000000000000000000000..579bddf4ca9684fb873b5e18652adf2e7730d492 GIT binary patch literal 1408 zcmcIj&2H2%5FR`G-`#F0Qc>R^r;Wsc6GDiB;80a1+X^WclqOa;!HE}pLR++Zf=A%S zWAXqn=tbuH-d7)q!#Zt1dgye;#u5 zi-HKaBPI%)WmMF;x}Pnu(#T-BZO$${ATi#RZ*EGJp~HZ*sn!&dU?7OF$rS}-OzK-N z#awC3!I1I2RrncIwIpX1^Xb@kf}O0Q;5KB|Lu}R8MmdZ*k=Tc4;C-m=4c;$nTM?2G zJaL!AMb}PQ7nQ~>qPHe%DpjM4E=gzVR7aQA_zI$3TlUe@eUKAptodtd2$agm`3gNe%IRY^>JB&2wZ+UZ(Y}nPtYRnSY@%DZyvI zF)jF^`q|+M@7gCft4yx6Yv**jzh^ry?ZkN)d6qV(S|~Z}e%`k?`RQd-{EWyRu16d+ chUq00(rERHADlZTG8SWTOq}np%E6Gr%#g~((9FOX#lw)w#E`|zkix={%EFMs z3L={sn4)+mGcx)x@=f+*?C0TNU|`5B_Dw7F&!jQ_skirTgn;Dp*cqR)o`Y`fNPGIbx u{D-lLn~Q;gfsIiJ2zfSlGvzU|3IheWC;wx%WC5`z_c3QpUdkfL$PNH{aTSXI