@@ -1,7 +1,7 | |||
|
1 | 1 | from django.db import models |
|
2 | 2 | from django.utils import timezone |
|
3 | 3 | |
|
4 |
class |
|
|
4 | class Profile(models.Model): | |
|
5 | 5 | |
|
6 | 6 | name = models.CharField(max_length=250) |
|
7 | 7 | date_create = models.DateTimeField() |
@@ -11,8 +11,6 | |||
|
11 | 11 | |
|
12 | 12 | class Meta: |
|
13 | 13 | db_table = "abs_profile_antenna" |
|
14 | verbose_name = "Profile of Configuration" | |
|
15 | verbose_name_plural = "Profiles of Configuration" | |
|
16 | 14 | |
|
17 | 15 | def save(self): |
|
18 | 16 | if self.pk is None: |
@@ -21,14 +19,15 | |||
|
21 | 19 | self.state = 1 |
|
22 | 20 | else: |
|
23 | 21 | self.date_modified = timezone.now() |
|
24 |
super( |
|
|
22 | super(Profile, self).save() | |
|
25 | 23 | |
|
26 | 24 | def __unicode__(self): |
|
27 |
return u'%s' % self. |
|
|
25 | return u'%s' % self.name | |
|
28 | 26 | |
|
29 |
class |
|
|
27 | class Pattern(models.Model): | |
|
30 | 28 | |
|
31 |
profile = models.ForeignKey( |
|
|
29 | profile = models.ForeignKey(Profile) | |
|
30 | value = models.PositiveIntegerField() | |
|
32 | 31 | date_create = models.DateTimeField() |
|
33 | 32 | date_modified = models.DateTimeField(null=True) |
|
34 | 33 | hits = models.PositiveIntegerField() |
@@ -36,26 +35,24 | |||
|
36 | 35 | |
|
37 | 36 | class Meta: |
|
38 | 37 | db_table = "abs_pattern_antenna" |
|
39 | verbose_name = "Pattern of Antenna" | |
|
40 | verbose_name_plural = "List of Patterns of Antenna" | |
|
41 | 38 | |
|
42 | def save(self): | |
|
43 |
if self.pk |
|
|
39 | def save(self, *args, **kwargs): | |
|
40 | if not self.pk: | |
|
44 | 41 | self.date_create = timezone.now() |
|
45 | 42 | self.hits = 0 |
|
46 | 43 | self.state = 1 |
|
47 | 44 | else: |
|
48 | 45 | self.date_modified = timezone.now() |
|
49 |
super( |
|
|
46 | super(Pattern, self).save(*args, **kwargs) | |
|
50 | 47 | |
|
51 | 48 | ''' |
|
52 | 49 | def __unicode__(self): |
|
53 | 50 | return u'%s' % self.value |
|
54 | 51 | ''' |
|
55 | 52 | |
|
56 |
class |
|
|
53 | class AntennaUp(models.Model): | |
|
57 | 54 | |
|
58 |
pattern = models.ForeignKey( |
|
|
55 | pattern = models.ForeignKey(Pattern) | |
|
59 | 56 | value = models.CharField(max_length=250) |
|
60 | 57 | tx = models.CharField(max_length=250) |
|
61 | 58 | rx = models.CharField(max_length=250) |
@@ -67,25 +64,23 | |||
|
67 | 64 | |
|
68 | 65 | class Meta: |
|
69 | 66 | db_table = "abs_antenna_up" |
|
70 | verbose_name = "Antenna Up" | |
|
71 | verbose_name_plural = "List of Antenna Up" | |
|
72 | 67 | |
|
73 | def save(self): | |
|
68 | def save(self, *args, **kwargs): | |
|
74 | 69 | if self.pk is None: |
|
75 | 70 | self.date_create = timezone.now() |
|
76 | 71 | self.hits = 0 |
|
77 | 72 | self.state = 1 |
|
78 | 73 | else: |
|
79 | 74 | self.date_modified = timezone.now() |
|
80 |
super( |
|
|
75 | super(AntennaUp, self).save(*args, **kwargs) | |
|
81 | 76 | |
|
82 | 77 | def __unicode__(self): |
|
83 | 78 | return u'%s' % self.value |
|
84 | 79 | |
|
85 | 80 | |
|
86 |
class |
|
|
81 | class AntennaDown(models.Model): | |
|
87 | 82 | |
|
88 |
pattern = models.ForeignKey( |
|
|
83 | pattern = models.ForeignKey(Pattern) | |
|
89 | 84 | value = models.CharField(max_length=250) |
|
90 | 85 | tx = models.CharField(max_length=250) |
|
91 | 86 | rx = models.CharField(max_length=250) |
@@ -97,17 +92,15 | |||
|
97 | 92 | |
|
98 | 93 | class Meta: |
|
99 | 94 | db_table = "abs_antenna_down" |
|
100 | verbose_name = "Antenna Down" | |
|
101 | verbose_name_plural = "List of Antenna Down" | |
|
102 | 95 | |
|
103 | def save(self): | |
|
96 | def save(self, *args, **kwargs): | |
|
104 | 97 | if self.pk is None: |
|
105 | 98 | self.date_create = timezone.now() |
|
106 | 99 | self.hits = 0 |
|
107 | 100 | self.state = 1 |
|
108 | 101 | else: |
|
109 | 102 | self.date_modified = timezone.now() |
|
110 |
super( |
|
|
103 | super(AntennaDown, self).save(*args, **kwargs) | |
|
111 | 104 | |
|
112 | 105 | def __unicode__(self): |
|
113 | 106 | return u'%s' % self.value |
@@ -4,7 +4,8 | |||
|
4 | 4 | url(r'^$', 'index'), |
|
5 | 5 | url(r'^new/$', 'new'), |
|
6 | 6 | url(r'^save/$', 'save'), |
|
7 |
url(r'^(?P<profile_id>\d+)/$', ' |
|
|
7 | url(r'^view/(?P<profile_id>\d+)/$', 'view'), | |
|
8 | #url(r'^(?P<profile_id>\d+)/$', 'detail'), | |
|
8 | 9 | #url(r'^(?P<poll_id>\d+)/results/$', 'results'), |
|
9 | 10 | #url(r'^(?P<poll_id>\d+)/vote/$', 'vote'), |
|
10 | 11 | ) No newline at end of file |
@@ -1,49 +1,42 | |||
|
1 | from django.shortcuts import render_to_response | |
|
2 | from django.http import HttpResponseRedirect | |
|
3 | from django.core.urlresolvers import reverse | |
|
4 | from django.template import RequestContext | |
|
5 | ||
|
6 | from abscontrol.models import profileAntenna, patternAntenna, antennaUp, antennaDown | |
|
1 | from django.shortcuts import render_to_response, redirect | |
|
2 | from abscontrol.models import Profile | |
|
7 | 3 | |
|
8 | 4 | def index(request): |
|
9 | 5 | #latest_poll_list = profileAntenna.objects.all().order_by('-pub_date')[:5] |
|
10 |
profile_list = |
|
|
6 | profile_list = Profile.objects.all() | |
|
11 | 7 | return render_to_response('abscontrol/index.html', {'profile_list': profile_list}) |
|
12 | 8 | |
|
13 | 9 | def new(request): |
|
14 |
|
|
|
15 | return render_to_response('abscontrol/new.html', {}) | |
|
10 | profile_list = Profile.objects.all() | |
|
11 | return render_to_response('abscontrol/new.html', {'profile_list': profile_list}) | |
|
16 | 12 | |
|
17 | 13 | def save(request): |
|
18 |
|
|
|
19 |
|
|
|
14 | ||
|
15 | txtProfile = request.POST["txtProfile"] | |
|
16 | ||
|
17 | txtAntennaUp = request.POST["txtAntennaUp"] | |
|
18 | txtTxUp = request.POST["txtTxUp"] | |
|
19 | txtRxUp = request.POST["txtRxUp"] | |
|
20 | txtUesUp = request.POST["txtUesUp"] | |
|
21 | ||
|
22 | txtAntennaDown = request.POST["txtAntennaDown"] | |
|
23 | txtTxDown = request.POST["txtTxDown"] | |
|
24 | txtRxDown = request.POST["txtRxDown"] | |
|
25 | txtUesDown = request.POST["txtUesDown"] | |
|
26 | ||
|
27 | newprofile = Profile(name=txtProfile) | |
|
28 | newprofile.save() | |
|
29 | ||
|
30 | newpattern = newprofile.pattern_set.create(value=1) | |
|
31 | newpattern.antennaup_set.create(value=txtAntennaUp, | |
|
32 | tx=txtTxUp,rx=txtRxUp, | |
|
33 | ues=txtUesUp) | |
|
34 | newpattern.antennadown_set.create(value=txtAntennaDown, | |
|
35 | tx=txtTxDown,rx=txtRxDown, | |
|
36 | ues=txtUesDown) | |
|
37 | ||
|
38 | return redirect('/abscontrol/') | |
|
39 | ||
|
40 | def view(request, profile_id): | |
|
41 | pass | |
|
20 | 42 | |
|
21 | txtAntennaUp = request.POST["txtAntennaUp"] | |
|
22 | txtTxUp = request.POST["txtTxUp"] | |
|
23 | txtRxUp = request.POST["txtRxUp"] | |
|
24 | txtUesUp = request.POST["txtUesUp"] | |
|
25 | ||
|
26 | txtAntennaDown = request.POST["txtAntennaDown"] | |
|
27 | txtTxDown = request.POST["txtTxDown"] | |
|
28 | txtRxDown = request.POST["txtRxDown"] | |
|
29 | txtUesDown = request.POST["txtUesDown"] | |
|
30 | ||
|
31 | objProfile = profileAntenna(name=txtProfile) | |
|
32 | objProfile.save() | |
|
33 | ||
|
34 | profile = profileAntenna.objects.get(pk=objProfile.id) | |
|
35 | print profile.id | |
|
36 | newpattern = profile.pattern_set.create() | |
|
37 | ''' | |
|
38 | pattern = patternAntenna.objects.get(pk=newpattern.id) | |
|
39 | pattern.antennaUp_set.create(value=txtAntennaUp, tx=txtTxUp, rx=txtRxUp, ues=txtUesUp) | |
|
40 | pattern.antennaDown_set.create(value=txtAntennaDown, tx=txtTxDown, rx=txtRxDown, ues=txtUesDown) | |
|
41 | ''' | |
|
42 | return HttpResponseRedirect(reverse('abscontrol.views.index')) | |
|
43 | ||
|
44 | except: | |
|
45 | # Redisplay the form | |
|
46 | return render_to_response('abscontrol/new.html', { | |
|
47 | 'error_message': "You didn't select a choice.", | |
|
48 | }, context_instance=RequestContext(request)) | |
|
49 |
@@ -1,3 +1,64 | |||
|
1 | @font-face { | |
|
2 | font-family: 'Open Sans'; | |
|
3 | font-style: normal; | |
|
4 | font-weight: 300; | |
|
5 | src: local('Open Sans Light'), local('OpenSans-Light'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/DXI1ORHCpsQm3Vp6mXoaTXhCUOGz7vYGh680lGh-uXM.woff) format('woff'); | |
|
6 | } | |
|
7 | @font-face { | |
|
8 | font-family: 'Open Sans'; | |
|
9 | font-style: normal; | |
|
10 | font-weight: 400; | |
|
11 | src: local('Open Sans'), local('OpenSans'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/cJZKeOuBrn4kERxqtaUH3T8E0i7KZn-EPnyo3HZu7kw.woff) format('woff'); | |
|
12 | } | |
|
13 | @font-face { | |
|
14 | font-family: 'Open Sans'; | |
|
15 | font-style: normal; | |
|
16 | font-weight: 600; | |
|
17 | src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNSnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); | |
|
18 | } | |
|
19 | @font-face { | |
|
20 | font-family: 'Open Sans'; | |
|
21 | font-style: normal; | |
|
22 | font-weight: 700; | |
|
23 | src: local('Open Sans Bold'), local('OpenSans-Bold'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/k3k702ZOKiLJc3WVjuplzHhCUOGz7vYGh680lGh-uXM.woff) format('woff'); | |
|
24 | } | |
|
25 | @font-face { | |
|
26 | font-family: 'Open Sans'; | |
|
27 | font-style: normal; | |
|
28 | font-weight: 800; | |
|
29 | src: local('Open Sans Extrabold'), local('OpenSans-Extrabold'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/EInbV5DfGHOiMmvb1Xr-hnhCUOGz7vYGh680lGh-uXM.woff) format('woff'); | |
|
30 | } | |
|
31 | @font-face { | |
|
32 | font-family: 'Open Sans'; | |
|
33 | font-style: italic; | |
|
34 | font-weight: 300; | |
|
35 | src: local('Open Sans Light Italic'), local('OpenSansLight-Italic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/PRmiXeptR36kaC0GEAetxh_xHqYgAV9Bl_ZQbYUxnQU.woff) format('woff'); | |
|
36 | } | |
|
37 | @font-face { | |
|
38 | font-family: 'Open Sans'; | |
|
39 | font-style: italic; | |
|
40 | font-weight: 400; | |
|
41 | src: local('Open Sans Italic'), local('OpenSans-Italic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/xjAJXh38I15wypJXxuGMBobN6UDyHWBl620a-IRfuBk.woff) format('woff'); | |
|
42 | } | |
|
43 | @font-face { | |
|
44 | font-family: 'Open Sans'; | |
|
45 | font-style: italic; | |
|
46 | font-weight: 600; | |
|
47 | src: local('Open Sans Semibold Italic'), local('OpenSans-SemiboldItalic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/PRmiXeptR36kaC0GEAetxn5HxGBcBvicCpTp6spHfNo.woff) format('woff'); | |
|
48 | } | |
|
49 | @font-face { | |
|
50 | font-family: 'Open Sans'; | |
|
51 | font-style: italic; | |
|
52 | font-weight: 700; | |
|
53 | src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/PRmiXeptR36kaC0GEAetxjqR_3kx9_hJXbbyU8S6IN0.woff) format('woff'); | |
|
54 | } | |
|
55 | @font-face { | |
|
56 | font-family: 'Open Sans'; | |
|
57 | font-style: italic; | |
|
58 | font-weight: 800; | |
|
59 | src: local('Open Sans Extrabold Italic'), local('OpenSans-ExtraboldItalic'), url(http://themes.googleusercontent.com/static/fonts/opensans/v6/PRmiXeptR36kaC0GEAetxkCDe67GEgBv_HnyvHTfdew.woff) format('woff'); | |
|
60 | } | |
|
61 | ||
|
1 | 62 | body {font-size: 11px; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif} |
|
2 | 63 | article, aside, figure, footer, header, hgroup, nav, section { display:block; } |
|
3 | 64 | header {border: 1px solid #fcc; font-size: 2em; height: 50px; text-align: center; line-height: 50px} |
@@ -15,6 +76,7 | |||
|
15 | 76 | /****************************************************************************************/ |
|
16 | 77 | #content #infoProfiles {border: 1px solid #d00; width: 140px; margin: 0px; padding-top: 2px; padding-bottom: 2px} |
|
17 | 78 | .lblInfo {padding-left: 12px; line-height: 20px;} |
|
79 | #infoProfiles select {padding-left: 12px; line-height: 20px;margin-left: 12px} | |
|
18 | 80 | #content nav {border: 1px solid #c55; width: 140px; margin: 0px; font-family: Monaco; font-size: 1.2em;} |
|
19 | 81 | #content nav ul{list-style: none; list-style-type: none; margin: 15px 15px 15px 15px; padding-left: 20px; border: 0px solid #eee} |
|
20 | 82 | #content nav ul li{line-height: 20px} |
General Comments 0
You need to be logged in to leave comments.
Login now