##// END OF EJS Templates
- Implementando la vista view del perfil.
jsalyrosas -
r125:126
parent child
Show More
@@ -0,0 +1,63
1 {% extends "abscontrol/index.html" %}
No newline at end of file
2 {% block title %}ABS CONTROL:::PROFILE:::{{ nameProfile }}{% endblock %}
No newline at end of file
3
No newline at end of file
4 {% block maincolumn%}
No newline at end of file
5 <div id="maincolumn">
No newline at end of file
6 <form action="/abscontrol/save/" method="post">
No newline at end of file
7 <div id="divProfile">
No newline at end of file
8 <label for="lblName">Profile:</label>
No newline at end of file
9 <label for="lblProfile">{{ nameProfile }}</label>
No newline at end of file
10 </div>
No newline at end of file
11 <div id="divPattern">
No newline at end of file
12 {% if patternChoosen %}
No newline at end of file
13 <label for="lblValue">Pattern:</label>
No newline at end of file
14 <label for="lblPatternValue">{{ patternChoosen.value }}</label>
No newline at end of file
15 {% endif %}
No newline at end of file
16 <div id="antennaUp">
No newline at end of file
17 <fieldset class="flsAntenna">
No newline at end of file
18 <legend>UP</legend>
No newline at end of file
19 <div class="divAntenna">
No newline at end of file
20 <label for="lblAntenna">Antenna</label>
No newline at end of file
21 <textarea name="txtAntennaUp" class="txtAntenna" cols="38" rows="8"></textarea>
No newline at end of file
22 </div>
No newline at end of file
23 <div class="divTx">
No newline at end of file
24 <label for="lblTx">Tx</label>
No newline at end of file
25 <textarea name="txtTxUp" class="txtTR" cols="20" rows="8"></textarea>
No newline at end of file
26 </div>
No newline at end of file
27 <div class="divTx">
No newline at end of file
28 <label for="lblRx">Rx</label>
No newline at end of file
29 <textarea name="txtRxUp" class="txtTR" cols="20" rows="8"></textarea>
No newline at end of file
30 </div>
No newline at end of file
31 <div class="cleardivs"></div>
No newline at end of file
32 <div class="divUes">
No newline at end of file
33 <label for="lblUes">Ues:</label>
No newline at end of file
34 <input type="text" name="txtUesUp" value="" />
No newline at end of file
35 </div>
No newline at end of file
36 </fieldset>
No newline at end of file
37 </div>
No newline at end of file
38 <div id="antennaDown">
No newline at end of file
39 <fieldset class="flsAntenna">
No newline at end of file
40 <legend>DOWN</legend>
No newline at end of file
41 <div class="divAntenna">
No newline at end of file
42 <label for="lblAntenna">Antenna</label>
No newline at end of file
43 <textarea name="txtAntennaDown" class="txtAntenna" cols="38" rows="8"></textarea>
No newline at end of file
44 </div>
No newline at end of file
45 <div class="divTx">
No newline at end of file
46 <label for="lblTx">Tx</label>
No newline at end of file
47 <textarea name="txtTxDown" class="txtTR" cols="20" rows="8"></textarea>
No newline at end of file
48 </div>
No newline at end of file
49 <div class="divTx">
No newline at end of file
50 <label for="lblRx">Rx</label>
No newline at end of file
51 <textarea name="txtRxDown" class="txtTR" cols="20" rows="8"></textarea>
No newline at end of file
52 </div>
No newline at end of file
53 <div class="cleardivs"></div>
No newline at end of file
54 <div class="divUes">
No newline at end of file
55 <label for="lblUes">Ues:</label>
No newline at end of file
56 <input type="text" name="txtUesDown" value="" />
No newline at end of file
57 </div>
No newline at end of file
58 </fieldset>
No newline at end of file
59 </div>
No newline at end of file
60 </div>
No newline at end of file
61 </form>
No newline at end of file
62 </div>
No newline at end of file
63 {% endblock %} No newline at end of file
@@ -1,42 +1,65
1 from django.shortcuts import render_to_response, redirect
1 from django.shortcuts import render_to_response, redirect
No newline at end of file
2 from abscontrol.models import Profile, AntennaDown, AntennaUp No newline at end of file
2 from abscontrol.models import Profile No newline at end of file
3 No newline at end of file
3
4 def index(request): No newline at end of file
4 def index(request):
5 #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] No newline at end of file
5 #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5]
6 profile_list = Profile.objects.all() No newline at end of file
6 profile_list = Profile.objects.all()
7 return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) No newline at end of file
7 return render_to_response('abscontrol/index.html', {'profile_list': profile_list})
8 No newline at end of file
8
9 def new(request): No newline at end of file
9 def new(request):
10 profile_list = Profile.objects.all() No newline at end of file
10 profile_list = Profile.objects.all()
11 return render_to_response('abscontrol/new.html', {'profile_list': profile_list}) No newline at end of file
11 return render_to_response('abscontrol/new.html', {'profile_list': profile_list})
12 No newline at end of file
12
13 def save(request): No newline at end of file
13 def save(request):
14 No newline at end of file
14
15 txtProfile = request.POST["txtProfile"] No newline at end of file
15 txtProfile = request.POST["txtProfile"]
16 No newline at end of file
16
17 txtAntennaUp = request.POST["txtAntennaUp"] No newline at end of file
17 txtAntennaUp = request.POST["txtAntennaUp"]
18 txtTxUp = request.POST["txtTxUp"] No newline at end of file
18 txtTxUp = request.POST["txtTxUp"]
19 txtRxUp = request.POST["txtRxUp"] No newline at end of file
19 txtRxUp = request.POST["txtRxUp"]
20 txtUesUp = request.POST["txtUesUp"] No newline at end of file
20 txtUesUp = request.POST["txtUesUp"]
21 No newline at end of file
21
22 txtAntennaDown = request.POST["txtAntennaDown"] No newline at end of file
22 txtAntennaDown = request.POST["txtAntennaDown"]
23 txtTxDown = request.POST["txtTxDown"] No newline at end of file
23 txtTxDown = request.POST["txtTxDown"]
24 txtRxDown = request.POST["txtRxDown"] No newline at end of file
24 txtRxDown = request.POST["txtRxDown"]
25 txtUesDown = request.POST["txtUesDown"] No newline at end of file
25 txtUesDown = request.POST["txtUesDown"]
26 No newline at end of file
26
27 newprofile = Profile(name=txtProfile) No newline at end of file
27 newprofile = Profile(name=txtProfile)
28 newprofile.save() No newline at end of file
28 newprofile.save()
29 No newline at end of file
29
30 newpattern = newprofile.pattern_set.create(value=1) No newline at end of file
30 newpattern = newprofile.pattern_set.create(value=1)
31 newpattern.antennaup_set.create(value=txtAntennaUp, No newline at end of file
31 newpattern.antennaup_set.create(value=txtAntennaUp,
32 tx=txtTxUp,rx=txtRxUp, No newline at end of file
32 tx=txtTxUp,rx=txtRxUp,
33 ues=txtUesUp) No newline at end of file
33 ues=txtUesUp)
34 newpattern.antennadown_set.create(value=txtAntennaDown, No newline at end of file
34 newpattern.antennadown_set.create(value=txtAntennaDown,
35 tx=txtTxDown,rx=txtRxDown, No newline at end of file
35 tx=txtTxDown,rx=txtRxDown,
36 ues=txtUesDown) No newline at end of file
36 ues=txtUesDown)
37
37
No newline at end of file
38 newurl = '/abscontrol/view/%d' % newprofile.id
38 return redirect('/abscontrol/') No newline at end of file
No newline at end of file
39 #return redirect('/abscontrol/')
No newline at end of file
40 return redirect(newurl) No newline at end of file
39 No newline at end of file
41
40 def view(request, profile_id):
42 def view(request, profile_id):
No newline at end of file
43 if request.method == 'GET' and 'pattern' in request.GET:
41 pass No newline at end of file
No newline at end of file
44 pattern_value = request.GET["pattern"]
No newline at end of file
45 else:
No newline at end of file
46 pattern_value = 1 No newline at end of file
42 No newline at end of file
47
48 profile_list = Profile.objects.all()
No newline at end of file
49 objProfile = Profile.objects.get(pk=profile_id)
No newline at end of file
50
No newline at end of file
51 lsPatterns = objProfile.pattern_set.all()
No newline at end of file
52 patternChoosen = objProfile.pattern_set.filter(value=pattern_value)
No newline at end of file
53 #print patternChoosen.value
No newline at end of file
54 #objAntennaUp = patternChoosen.antennaup_set.all()[0]
No newline at end of file
55 #objAntennaDown = patternChoosen.antennadown_set.all()[0]
No newline at end of file
56
No newline at end of file
57 #objAntennaUp = AntennaUp.objects.get(pattern=patternChoosen.id)
No newline at end of file
58 #objAntennaDown = AntennaDown.objects.get(pattern=patternChoosen.id)
No newline at end of file
59 '''
No newline at end of file
60 return render_to_response('abscontrol/view.html', {'nameProfile': objProfile.name, 'profile_list': profile_list,
No newline at end of file
61 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns,
No newline at end of file
62 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown,})
No newline at end of file
63 '''
No newline at end of file
64 return render_to_response('abscontrol/view.html', {'nameProfile': objProfile.name, 'profile_list': profile_list,
No newline at end of file
65 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns,}) No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now