##// END OF EJS Templates
- Corregida la vista view para visualizar el perfil con el patron 1 por defecto.
jsalyrosas -
r126:127
parent child
Show More
@@ -1,65 +1,59
1 from django.shortcuts import render_to_response, redirect No newline at end of file
1 from django.shortcuts import render_to_response, redirect
2 from abscontrol.models import Profile, AntennaDown, AntennaUp No newline at end of file
2 from abscontrol.models import Profile, AntennaDown, AntennaUp
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 No newline at end of file
37
38 newurl = '/abscontrol/view/%d' % newprofile.id No newline at end of file
38 newurl = '/abscontrol/view/%d' % newprofile.id
39 #return redirect('/abscontrol/') No newline at end of file
39 #return redirect('/abscontrol/')
40 return redirect(newurl) No newline at end of file
40 return redirect(newurl)
41 No newline at end of file
41
42 def view(request, profile_id): No newline at end of file
42 def view(request, profile_id):
43 if request.method == 'GET' and 'pattern' in request.GET: No newline at end of file
43 if request.method == 'GET' and 'pattern' in request.GET:
44 pattern_value = request.GET["pattern"] No newline at end of file
44 pattern_value = request.GET["pattern"]
45 else: No newline at end of file
45 else:
46 pattern_value = 1 No newline at end of file
46 pattern_value = 1
47 No newline at end of file
47
48 profile_list = Profile.objects.all() No newline at end of file
48 profile_list = Profile.objects.all()
49 objProfile = Profile.objects.get(pk=profile_id) No newline at end of file
49 objProfile = Profile.objects.get(pk=profile_id)
50 No newline at end of file
50
51 lsPatterns = objProfile.pattern_set.all()
51 lsPatterns = objProfile.pattern_set.all()
No newline at end of file
52 patternChoosen = objProfile.pattern_set.get(value=pattern_value)
52 patternChoosen = objProfile.pattern_set.filter(value=pattern_value)
No newline at end of file
No newline at end of file
53 objAntennaUp = patternChoosen.antennaup_set.get()
53 #print patternChoosen.value
No newline at end of file
No newline at end of file
54 objAntennaDown = patternChoosen.antennadown_set.get() 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
55
No newline at end of file
56 return render_to_response('abscontrol/view.html', {'objProfile': objProfile, 'profile_list': profile_list, 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,
57 'patternChoosen' : patternChoosen, 'lsPatterns' : lsPatterns,
No newline at end of file
58 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown,
62 'antennaUp' : objAntennaUp, 'antennaDown' : objAntennaDown,})
No newline at end of file
No newline at end of file
59 }) 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
@@ -1,44 +1,52
1 {% extends "base.html" %} No newline at end of file
1 {% extends "base.html" %}
2 No newline at end of file
2
3 {% block title %}ABS CONTROL:::::{% endblock %} No newline at end of file
3 {% block title %}ABS CONTROL:::::{% endblock %}
4 No newline at end of file
4
5 {% block content %} No newline at end of file
5 {% block content %}
6 <div id="content"> No newline at end of file
6 <div id="content">
7 {% block leftcolumn %} No newline at end of file
7 {% block leftcolumn %}
8 <div id="leftcolumn"> No newline at end of file
8 <div id="leftcolumn">
9 <div id="lsProfiles"> No newline at end of file
9 <div id="lsProfiles">
10 <div id="infoProfiles"> No newline at end of file
10 <div id="infoProfiles">
11 <label for="lblProfile" class="lblInfo">Profiles:</label><br /> No newline at end of file
11 <label for="lblProfile" class="lblInfo">Profiles:</label><br />
12 {% if profile_list %} No newline at end of file
12 {% if profile_list %}
13 <select name="lsProfiles"> No newline at end of file
13 <select name="lsProfiles">
14 <option>Choose ...</option> No newline at end of file
14 <option>Choose ...</option>
15 {% for entry in profile_list %} No newline at end of file
15 {% for entry in profile_list %}
16 {% if objProfile %}
No newline at end of file
17 {% if objProfile.id == entry.id %}
No newline at end of file
18 <option value="{{ entry.id }}" selected>{{ entry.name }}</option>
No newline at end of file
19 {% else %} No newline at end of file
16 <option value="{{ entry.id }}">{{ entry.name }}</option> No newline at end of file
20 <option value="{{ entry.id }}">{{ entry.name }}</option>
21 {% endif %}
No newline at end of file
22 {% else %}
No newline at end of file
23 <option value="{{ entry.id }}">{{ entry.name }}</option>
No newline at end of file
24 {% endif %} No newline at end of file
17 {% endfor %} No newline at end of file
25 {% endfor %}
18 </select> No newline at end of file
26 </select>
19 {% else %} No newline at end of file
27 {% else %}
20 <label for="lblMessage" class="lblInfo">No profiles.</label> No newline at end of file
28 <label for="lblMessage" class="lblInfo">No profiles.</label>
21 {% endif %} No newline at end of file
29 {% endif %}
22 </div> No newline at end of file
30 </div>
23 </div> No newline at end of file
31 </div>
24 {% block mnu_profile %} No newline at end of file
32 {% block mnu_profile %}
25 <nav> No newline at end of file
33 <nav>
26 <ul> No newline at end of file
34 <ul>
27 <li><a href="/abscontrol/new">New</a></li> No newline at end of file
35 <li><a href="/abscontrol/new">New</a></li>
28 <li><a href="#">Save as</a></li> No newline at end of file
36 <li><a href="#">Save as</a></li>
29 <li><a href="#">Import</a></li> No newline at end of file
37 <li><a href="#">Import</a></li>
30 <li><a href="#">Export</a></li> No newline at end of file
38 <li><a href="#">Export</a></li>
31 <li><a href="#">Apply</a></li> No newline at end of file
39 <li><a href="#">Apply</a></li>
32 </ul> No newline at end of file
40 </ul>
33 </nav> No newline at end of file
41 </nav>
34 {% endblock %} No newline at end of file
42 {% endblock %}
35 </div> No newline at end of file
43 </div>
36 {% endblock %} No newline at end of file
44 {% endblock %}
37 {% block maincolumn %} No newline at end of file
45 {% block maincolumn %}
38 <div id="maincolumn"> No newline at end of file
46 <div id="maincolumn">
39 No newline at end of file
47
40 </div> No newline at end of file
48 </div>
41 {% endblock %} No newline at end of file
49 {% endblock %}
42 <div class="cleardivs"></div> No newline at end of file
50 <div class="cleardivs"></div>
43 </div> No newline at end of file
51 </div>
44 {% endblock %} No newline at end of file
52 {% endblock %}
@@ -1,63 +1,63
1 {% extends "abscontrol/index.html" %}
1 {% extends "abscontrol/index.html" %}
No newline at end of file
2 {% block title %}ABS CONTROL:::PROFILE:::{{ objProfile.name }}{% endblock %} 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
3
4 {% block maincolumn%} No newline at end of file
4 {% block maincolumn%}
5 <div id="maincolumn"> No newline at end of file
5 <div id="maincolumn">
6 <form action="/abscontrol/save/" method="post"> No newline at end of file
6 <form action="/abscontrol/save/" method="post">
7 <div id="divProfile"> No newline at end of file
7 <div id="divProfile">
8 <label for="lblName">Profile:</label>
8 <label for="lblName">Profile:</label>
No newline at end of file
9 <label for="lblProfile">{{ objProfile.name }}</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
10 </div>
11 <div id="divPattern"> No newline at end of file
11 <div id="divPattern">
12 {% if patternChoosen %} No newline at end of file
12 {% if patternChoosen %}
13 <label for="lblValue">Pattern:</label> No newline at end of file
13 <label for="lblValue">Pattern:</label>
14 <label for="lblPatternValue">{{ patternChoosen.value }}</label> No newline at end of file
14 <label for="lblPatternValue">{{ patternChoosen.value }}</label>
15 {% endif %} No newline at end of file
15 {% endif %}
16 <div id="antennaUp"> No newline at end of file
16 <div id="antennaUp">
17 <fieldset class="flsAntenna"> No newline at end of file
17 <fieldset class="flsAntenna">
18 <legend>UP</legend> No newline at end of file
18 <legend>UP</legend>
19 <div class="divAntenna"> No newline at end of file
19 <div class="divAntenna">
20 <label for="lblAntenna">Antenna</label>
20 <label for="lblAntenna">Antenna</label>
No newline at end of file
21 <textarea name="txtAntennaUp" class="txtAntenna" cols="38" rows="8">{{ antennaUp.value }}</textarea> 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
22 </div>
23 <div class="divTx"> No newline at end of file
23 <div class="divTx">
24 <label for="lblTx">Tx</label>
24 <label for="lblTx">Tx</label>
No newline at end of file
25 <textarea name="txtTxUp" class="txtTR" cols="20" rows="8">{{ antennaUp.tx }}</textarea> 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
26 </div>
27 <div class="divTx"> No newline at end of file
27 <div class="divTx">
28 <label for="lblRx">Rx</label>
28 <label for="lblRx">Rx</label>
No newline at end of file
29 <textarea name="txtRxUp" class="txtTR" cols="20" rows="8">{{ antennaUp.rx }}</textarea> 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
30 </div>
31 <div class="cleardivs"></div> No newline at end of file
31 <div class="cleardivs"></div>
32 <div class="divUes"> No newline at end of file
32 <div class="divUes">
33 <label for="lblUes">Ues:</label>
33 <label for="lblUes">Ues:</label>
No newline at end of file
34 <label for="lblAntennaUpUes">{{ antennaUp.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
35 </div>
36 </fieldset> No newline at end of file
36 </fieldset>
37 </div> No newline at end of file
37 </div>
38 <div id="antennaDown"> No newline at end of file
38 <div id="antennaDown">
39 <fieldset class="flsAntenna"> No newline at end of file
39 <fieldset class="flsAntenna">
40 <legend>DOWN</legend> No newline at end of file
40 <legend>DOWN</legend>
41 <div class="divAntenna"> No newline at end of file
41 <div class="divAntenna">
42 <label for="lblAntenna">Antenna</label>
42 <label for="lblAntenna">Antenna</label>
No newline at end of file
43 <textarea name="txtAntennaDown" class="txtAntenna" cols="38" rows="8">{{ antennaDown.value }}</textarea> 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
44 </div>
45 <div class="divTx"> No newline at end of file
45 <div class="divTx">
46 <label for="lblTx">Tx</label>
46 <label for="lblTx">Tx</label>
No newline at end of file
47 <textarea name="txtTxDown" class="txtTR" cols="20" rows="8">{{ antennaDown.tx }}</textarea> 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
48 </div>
49 <div class="divTx"> No newline at end of file
49 <div class="divTx">
50 <label for="lblRx">Rx</label>
50 <label for="lblRx">Rx</label>
No newline at end of file
51 <textarea name="txtRxDown" class="txtTR" cols="20" rows="8">{{ antennaDown.rx }}</textarea> 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
52 </div>
53 <div class="cleardivs"></div> No newline at end of file
53 <div class="cleardivs"></div>
54 <div class="divUes"> No newline at end of file
54 <div class="divUes">
55 <label for="lblUes">Ues:</label>
55 <label for="lblUes">Ues:</label>
No newline at end of file
56 <label for="lblAntennaDownUes">{{ antennaDown.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
57 </div>
58 </fieldset> No newline at end of file
58 </fieldset>
59 </div> No newline at end of file
59 </div>
60 </div> No newline at end of file
60 </div>
61 </form> No newline at end of file
61 </form>
62 </div> No newline at end of file
62 </div>
63 {% endblock %} No newline at end of file
63 {% endblock %}
General Comments 0
You need to be logged in to leave comments. Login now