@@ -0,0 +1,33 | |||||
|
1 | from abscontrol.models import Profile, Pattern, AntennaUp, AntennaDown | |||
|
2 | from django.contrib import admin | |||
|
3 | ||||
|
4 | class AntennaUpInline(admin.StackedInline): | |||
|
5 | model = AntennaUp | |||
|
6 | ||||
|
7 | class AntennaDownInline(admin.StackedInline): | |||
|
8 | model = AntennaDown | |||
|
9 | ||||
|
10 | class PatternAdmin(admin.ModelAdmin): | |||
|
11 | fieldsets = [ | |||
|
12 | (None, {'fields': ['value']}), | |||
|
13 | ('Date information', {'fields': ['date_create', 'date_modified'], 'classes': ['collapse']}), | |||
|
14 | ] | |||
|
15 | inlines = [AntennaUpInline] | |||
|
16 | inlines = [AntennaDownInline] | |||
|
17 | ||||
|
18 | class PatternInline(admin.StackedInline): | |||
|
19 | model = Pattern | |||
|
20 | extra = 0 | |||
|
21 | ||||
|
22 | class ProfileAdmin(admin.ModelAdmin): | |||
|
23 | fieldsets = [ | |||
|
24 | (None, {'fields': ['name']}), | |||
|
25 | ('Date information', {'fields': ['date_create', 'date_modified'], 'classes': ['collapse']}), | |||
|
26 | ] | |||
|
27 | inlines = [PatternInline] | |||
|
28 | ||||
|
29 | ||||
|
30 | admin.site.register(Profile, ProfileAdmin) | |||
|
31 | admin.site.register(Pattern, PatternAdmin) | |||
|
32 | admin.site.register(AntennaUp) | |||
|
33 | admin.site.register(AntennaDown) No newline at end of file |
@@ -1,159 +1,159 | |||||
1 | # Django settings for abs_webapp_dev project. |
|
1 | # Django settings for abs_webapp_dev project. | |
2 |
|
2 | |||
3 | import os |
|
3 | import os | |
4 | PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] |
|
4 | PROJECT_DIR = os.path.split(os.path.dirname(__file__))[0] | |
5 |
|
5 | |||
6 | DEBUG = True |
|
6 | DEBUG = True | |
7 | TEMPLATE_DEBUG = DEBUG |
|
7 | TEMPLATE_DEBUG = DEBUG | |
8 |
|
8 | |||
9 | ADMINS = ( |
|
9 | ADMINS = ( | |
10 | # ('Your Name', 'your_email@example.com'), |
|
10 | # ('Your Name', 'your_email@example.com'), | |
11 | ) |
|
11 | ) | |
12 |
|
12 | |||
13 | MANAGERS = ADMINS |
|
13 | MANAGERS = ADMINS | |
14 |
|
14 | |||
15 | DATABASES = { |
|
15 | DATABASES = { | |
16 | 'default': { |
|
16 | 'default': { | |
17 | 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. |
|
17 | 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. | |
18 | 'NAME': 'db_jrowebapp_dev', # Or path to database file if using sqlite3. |
|
18 | 'NAME': 'db_jrowebapp_dev', # Or path to database file if using sqlite3. | |
19 | 'USER': 'abscontrol', # Not used with sqlite3. |
|
19 | 'USER': 'abscontrol', # Not used with sqlite3. | |
20 | 'PASSWORD': 'abscontrol', # Not used with sqlite3. |
|
20 | 'PASSWORD': 'abscontrol', # Not used with sqlite3. | |
21 | 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. |
|
21 | 'HOST': 'localhost', # Set to empty string for localhost. Not used with sqlite3. | |
22 | 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. |
|
22 | 'PORT': '3306', # Set to empty string for default. Not used with sqlite3. | |
23 | } |
|
23 | } | |
24 | } |
|
24 | } | |
25 |
|
25 | |||
26 | # Local time zone for this installation. Choices can be found here: |
|
26 | # Local time zone for this installation. Choices can be found here: | |
27 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name |
|
27 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | |
28 | # although not all choices may be available on all operating systems. |
|
28 | # although not all choices may be available on all operating systems. | |
29 | # In a Windows environment this must be set to your system time zone. |
|
29 | # In a Windows environment this must be set to your system time zone. | |
30 | TIME_ZONE = 'America/Lima' |
|
30 | TIME_ZONE = 'America/Lima' | |
31 |
|
31 | |||
32 | # Language code for this installation. All choices can be found here: |
|
32 | # Language code for this installation. All choices can be found here: | |
33 | # http://www.i18nguy.com/unicode/language-identifiers.html |
|
33 | # http://www.i18nguy.com/unicode/language-identifiers.html | |
34 | LANGUAGE_CODE = 'en-us' |
|
34 | LANGUAGE_CODE = 'en-us' | |
35 |
|
35 | |||
36 | SITE_ID = 1 |
|
36 | SITE_ID = 1 | |
37 |
|
37 | |||
38 | # If you set this to False, Django will make some optimizations so as not |
|
38 | # If you set this to False, Django will make some optimizations so as not | |
39 | # to load the internationalization machinery. |
|
39 | # to load the internationalization machinery. | |
40 | USE_I18N = True |
|
40 | USE_I18N = True | |
41 |
|
41 | |||
42 | # If you set this to False, Django will not format dates, numbers and |
|
42 | # If you set this to False, Django will not format dates, numbers and | |
43 | # calendars according to the current locale. |
|
43 | # calendars according to the current locale. | |
44 | USE_L10N = True |
|
44 | USE_L10N = True | |
45 |
|
45 | |||
46 | # If you set this to False, Django will not use timezone-aware datetimes. |
|
46 | # If you set this to False, Django will not use timezone-aware datetimes. | |
47 | USE_TZ = True |
|
47 | USE_TZ = True | |
48 |
|
48 | |||
49 | # Absolute filesystem path to the directory that will hold user-uploaded files. |
|
49 | # Absolute filesystem path to the directory that will hold user-uploaded files. | |
50 | # Example: "/home/media/media.lawrence.com/media/" |
|
50 | # Example: "/home/media/media.lawrence.com/media/" | |
51 | MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media').replace('\\', '/') |
|
51 | MEDIA_ROOT = os.path.join(PROJECT_DIR, 'media').replace('\\', '/') | |
52 |
|
52 | |||
53 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a |
|
53 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a | |
54 | # trailing slash. |
|
54 | # trailing slash. | |
55 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" |
|
55 | # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" | |
56 | MEDIA_URL = '/media/' |
|
56 | MEDIA_URL = '/media/' | |
57 |
|
57 | |||
58 | # Absolute path to the directory static files should be collected to. |
|
58 | # Absolute path to the directory static files should be collected to. | |
59 | # Don't put anything in this directory yourself; store your static files |
|
59 | # Don't put anything in this directory yourself; store your static files | |
60 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. |
|
60 | # in apps' "static/" subdirectories and in STATICFILES_DIRS. | |
61 | # Example: "/home/media/media.lawrence.com/static/" |
|
61 | # Example: "/home/media/media.lawrence.com/static/" | |
62 | #STATIC_ROOT = os.path.join(PROJECT_DIR, 'static-serve').replace('\\', '/'), |
|
62 | #STATIC_ROOT = os.path.join(PROJECT_DIR, 'static-serve').replace('\\', '/'), | |
63 | STATIC_ROOT = '' |
|
63 | STATIC_ROOT = '' | |
64 |
|
64 | |||
65 | # URL prefix for static files. |
|
65 | # URL prefix for static files. | |
66 | # Example: "http://media.lawrence.com/static/" |
|
66 | # Example: "http://media.lawrence.com/static/" | |
67 | STATIC_URL = '/static/' |
|
67 | STATIC_URL = '/static/' | |
68 |
|
68 | |||
69 | # Additional locations of static files |
|
69 | # Additional locations of static files | |
70 | STATICFILES_DIRS = ( |
|
70 | STATICFILES_DIRS = ( | |
71 | # Put strings here, like "/home/html/static" or "C:/www/django/static". |
|
71 | # Put strings here, like "/home/html/static" or "C:/www/django/static". | |
72 | # Always use forward slashes, even on Windows. |
|
72 | # Always use forward slashes, even on Windows. | |
73 | # Don't forget to use absolute paths, not relative paths. |
|
73 | # Don't forget to use absolute paths, not relative paths. | |
74 | #os.path.join(PROJECT_DIR, "static").replace('\\', '/'), |
|
74 | #os.path.join(PROJECT_DIR, "static").replace('\\', '/'), | |
75 | ("static", os.path.join(PROJECT_DIR, "static").replace('\\', '/')), |
|
75 | ("static", os.path.join(PROJECT_DIR, "static").replace('\\', '/')), | |
76 | ) |
|
76 | ) | |
77 |
|
77 | |||
78 | # List of finder classes that know how to find static files in |
|
78 | # List of finder classes that know how to find static files in | |
79 | # various locations. |
|
79 | # various locations. | |
80 | STATICFILES_FINDERS = ( |
|
80 | STATICFILES_FINDERS = ( | |
81 | 'django.contrib.staticfiles.finders.FileSystemFinder', |
|
81 | 'django.contrib.staticfiles.finders.FileSystemFinder', | |
82 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', |
|
82 | 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
83 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', |
|
83 | # 'django.contrib.staticfiles.finders.DefaultStorageFinder', | |
84 | ) |
|
84 | ) | |
85 |
|
85 | |||
86 | # Make this unique, and don't share it with anybody. |
|
86 | # Make this unique, and don't share it with anybody. | |
87 | SECRET_KEY = '=^abu)gd=)7hf#rme_vw=tv!bdh7+tts*^&)h(n=7@7(9#__@e' |
|
87 | SECRET_KEY = '=^abu)gd=)7hf#rme_vw=tv!bdh7+tts*^&)h(n=7@7(9#__@e' | |
88 |
|
88 | |||
89 | # List of callables that know how to import templates from various sources. |
|
89 | # List of callables that know how to import templates from various sources. | |
90 | TEMPLATE_LOADERS = ( |
|
90 | TEMPLATE_LOADERS = ( | |
91 | 'django.template.loaders.filesystem.Loader', |
|
91 | 'django.template.loaders.filesystem.Loader', | |
92 | 'django.template.loaders.app_directories.Loader', |
|
92 | 'django.template.loaders.app_directories.Loader', | |
93 | # 'django.template.loaders.eggs.Loader', |
|
93 | # 'django.template.loaders.eggs.Loader', | |
94 | ) |
|
94 | ) | |
95 |
|
95 | |||
96 | MIDDLEWARE_CLASSES = ( |
|
96 | MIDDLEWARE_CLASSES = ( | |
97 | 'django.middleware.common.CommonMiddleware', |
|
97 | 'django.middleware.common.CommonMiddleware', | |
98 | 'django.contrib.sessions.middleware.SessionMiddleware', |
|
98 | 'django.contrib.sessions.middleware.SessionMiddleware', | |
99 | #'django.middleware.csrf.CsrfViewMiddleware', |
|
99 | #'django.middleware.csrf.CsrfViewMiddleware', | |
100 | 'django.contrib.auth.middleware.AuthenticationMiddleware', |
|
100 | 'django.contrib.auth.middleware.AuthenticationMiddleware', | |
101 | 'django.contrib.messages.middleware.MessageMiddleware', |
|
101 | 'django.contrib.messages.middleware.MessageMiddleware', | |
102 | # Uncomment the next line for simple clickjacking protection: |
|
102 | # Uncomment the next line for simple clickjacking protection: | |
103 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
|
103 | # 'django.middleware.clickjacking.XFrameOptionsMiddleware', | |
104 | ) |
|
104 | ) | |
105 |
|
105 | |||
106 | ROOT_URLCONF = 'abs_webapp_dev.urls' |
|
106 | ROOT_URLCONF = 'abs_webapp_dev.urls' | |
107 |
|
107 | |||
108 | # Python dotted path to the WSGI application used by Django's runserver. |
|
108 | # Python dotted path to the WSGI application used by Django's runserver. | |
109 | WSGI_APPLICATION = 'abs_webapp_dev.wsgi.application' |
|
109 | WSGI_APPLICATION = 'abs_webapp_dev.wsgi.application' | |
110 |
|
110 | |||
111 | TEMPLATE_DIRS = ( |
|
111 | TEMPLATE_DIRS = ( | |
112 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". |
|
112 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | |
113 | # Always use forward slashes, even on Windows. |
|
113 | # Always use forward slashes, even on Windows. | |
114 | # Don't forget to use absolute paths, not relative paths. |
|
114 | # Don't forget to use absolute paths, not relative paths. | |
115 | os.path.join(PROJECT_DIR, "templates").replace('\\', '/'), |
|
115 | os.path.join(PROJECT_DIR, "templates").replace('\\', '/'), | |
116 | ) |
|
116 | ) | |
117 |
|
117 | |||
118 | INSTALLED_APPS = ( |
|
118 | INSTALLED_APPS = ( | |
119 | 'django.contrib.auth', |
|
119 | 'django.contrib.auth', | |
120 | 'django.contrib.contenttypes', |
|
120 | 'django.contrib.contenttypes', | |
121 | 'django.contrib.sessions', |
|
121 | 'django.contrib.sessions', | |
122 | 'django.contrib.sites', |
|
122 | 'django.contrib.sites', | |
123 | 'django.contrib.messages', |
|
123 | 'django.contrib.messages', | |
124 | 'django.contrib.staticfiles', |
|
124 | 'django.contrib.staticfiles', | |
125 | # Uncomment the next line to enable the admin: |
|
125 | # Uncomment the next line to enable the admin: | |
126 |
|
|
126 | 'django.contrib.admin', | |
127 | # Uncomment the next line to enable admin documentation: |
|
127 | # Uncomment the next line to enable admin documentation: | |
128 | # 'django.contrib.admindocs', |
|
128 | # 'django.contrib.admindocs', | |
129 | 'abscontrol', |
|
129 | 'abscontrol', | |
130 | ) |
|
130 | ) | |
131 |
|
131 | |||
132 | # A sample logging configuration. The only tangible logging |
|
132 | # A sample logging configuration. The only tangible logging | |
133 | # performed by this configuration is to send an email to |
|
133 | # performed by this configuration is to send an email to | |
134 | # the site admins on every HTTP 500 error when DEBUG=False. |
|
134 | # the site admins on every HTTP 500 error when DEBUG=False. | |
135 | # See http://docs.djangoproject.com/en/dev/topics/logging for |
|
135 | # See http://docs.djangoproject.com/en/dev/topics/logging for | |
136 | # more details on how to customize your logging configuration. |
|
136 | # more details on how to customize your logging configuration. | |
137 | LOGGING = { |
|
137 | LOGGING = { | |
138 | 'version': 1, |
|
138 | 'version': 1, | |
139 | 'disable_existing_loggers': False, |
|
139 | 'disable_existing_loggers': False, | |
140 | 'filters': { |
|
140 | 'filters': { | |
141 | 'require_debug_false': { |
|
141 | 'require_debug_false': { | |
142 | '()': 'django.utils.log.RequireDebugFalse' |
|
142 | '()': 'django.utils.log.RequireDebugFalse' | |
143 | } |
|
143 | } | |
144 | }, |
|
144 | }, | |
145 | 'handlers': { |
|
145 | 'handlers': { | |
146 | 'mail_admins': { |
|
146 | 'mail_admins': { | |
147 | 'level': 'ERROR', |
|
147 | 'level': 'ERROR', | |
148 | 'filters': ['require_debug_false'], |
|
148 | 'filters': ['require_debug_false'], | |
149 | 'class': 'django.utils.log.AdminEmailHandler' |
|
149 | 'class': 'django.utils.log.AdminEmailHandler' | |
150 | } |
|
150 | } | |
151 | }, |
|
151 | }, | |
152 | 'loggers': { |
|
152 | 'loggers': { | |
153 | 'django.request': { |
|
153 | 'django.request': { | |
154 | 'handlers': ['mail_admins'], |
|
154 | 'handlers': ['mail_admins'], | |
155 | 'level': 'ERROR', |
|
155 | 'level': 'ERROR', | |
156 | 'propagate': True, |
|
156 | 'propagate': True, | |
157 | }, |
|
157 | }, | |
158 | } |
|
158 | } | |
159 | } |
|
159 | } |
@@ -1,18 +1,18 | |||||
1 | from django.conf.urls import patterns, include, url |
|
1 | from django.conf.urls import patterns, include, url | |
2 |
|
2 | |||
3 | # Uncomment the next two lines to enable the admin: |
|
3 | # Uncomment the next two lines to enable the admin: | |
4 |
|
|
4 | from django.contrib import admin | |
5 |
|
|
5 | admin.autodiscover() | |
6 |
|
6 | |||
7 | urlpatterns = patterns('', |
|
7 | urlpatterns = patterns('', | |
8 | # Examples: |
|
8 | # Examples: | |
9 | # url(r'^$', 'abs_webapp_dev.views.home', name='home'), |
|
9 | # url(r'^$', 'abs_webapp_dev.views.home', name='home'), | |
10 | # url(r'^abs_webapp_dev/', include('abs_webapp_dev.foo.urls')), |
|
10 | # url(r'^abs_webapp_dev/', include('abs_webapp_dev.foo.urls')), | |
11 |
|
11 | |||
12 | # Uncomment the admin/doc line below to enable admin documentation: |
|
12 | # Uncomment the admin/doc line below to enable admin documentation: | |
13 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), |
|
13 | # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), | |
14 |
|
14 | |||
15 | # Uncomment the next line to enable the admin: |
|
15 | # Uncomment the next line to enable the admin: | |
16 |
|
|
16 | url(r'^admin/', include(admin.site.urls)), | |
17 | url(r'^abscontrol/', include('abscontrol.urls')), |
|
17 | url(r'^abscontrol/', include('abscontrol.urls')), | |
18 | ) |
|
18 | ) |
@@ -1,106 +1,105 | |||||
1 | from django.db import models |
|
1 | from django.db import models | |
2 | from django.utils import timezone |
|
2 | from django.utils import timezone | |
3 |
|
3 | |||
4 | class Profile(models.Model): |
|
4 | class Profile(models.Model): | |
5 |
|
5 | |||
6 | name = models.CharField(max_length=250) |
|
6 | name = models.CharField(max_length=250) | |
7 | date_create = models.DateTimeField() |
|
7 | date_create = models.DateTimeField() | |
8 | date_modified = models.DateTimeField(null=True) |
|
8 | date_modified = models.DateTimeField(null=True) | |
9 | hits = models.PositiveIntegerField() |
|
9 | hits = models.PositiveIntegerField() | |
10 | state = models.PositiveSmallIntegerField() |
|
10 | state = models.PositiveSmallIntegerField() | |
11 |
|
11 | |||
12 | class Meta: |
|
12 | class Meta: | |
13 | db_table = "abs_profile_antenna" |
|
13 | db_table = "abs_profile_antenna" | |
14 |
|
14 | |||
15 | def save(self): |
|
15 | def save(self): | |
16 | if self.pk is None: |
|
16 | if self.pk is None: | |
17 | self.date_create = timezone.now() |
|
17 | self.date_create = timezone.now() | |
18 | self.hits = 0 |
|
18 | self.hits = 0 | |
19 | self.state = 1 |
|
19 | self.state = 1 | |
20 | else: |
|
20 | else: | |
21 | self.date_modified = timezone.now() |
|
21 | self.date_modified = timezone.now() | |
22 | super(Profile, self).save() |
|
22 | super(Profile, self).save() | |
23 |
|
23 | |||
24 | def __unicode__(self): |
|
24 | def __unicode__(self): | |
25 | return u'%s' % self.name |
|
25 | return u'%s' % self.name | |
26 |
|
26 | |||
27 | class Pattern(models.Model): |
|
27 | class Pattern(models.Model): | |
28 |
|
28 | |||
29 | profile = models.ForeignKey(Profile) |
|
29 | profile = models.ForeignKey(Profile) | |
30 | value = models.PositiveIntegerField() |
|
30 | value = models.PositiveIntegerField() | |
31 | date_create = models.DateTimeField() |
|
31 | date_create = models.DateTimeField() | |
32 | date_modified = models.DateTimeField(null=True) |
|
32 | date_modified = models.DateTimeField(null=True) | |
33 | hits = models.PositiveIntegerField() |
|
33 | hits = models.PositiveIntegerField() | |
34 | state = models.PositiveSmallIntegerField() |
|
34 | state = models.PositiveSmallIntegerField() | |
35 |
|
35 | |||
36 | class Meta: |
|
36 | class Meta: | |
37 | db_table = "abs_pattern_antenna" |
|
37 | db_table = "abs_pattern_antenna" | |
38 |
|
38 | |||
39 | def save(self, *args, **kwargs): |
|
39 | def save(self, *args, **kwargs): | |
40 | if not self.pk: |
|
40 | if not self.pk: | |
41 | self.date_create = timezone.now() |
|
41 | self.date_create = timezone.now() | |
42 | self.hits = 0 |
|
42 | self.hits = 0 | |
43 | self.state = 1 |
|
43 | self.state = 1 | |
44 | else: |
|
44 | else: | |
45 | self.date_modified = timezone.now() |
|
45 | self.date_modified = timezone.now() | |
46 | super(Pattern, self).save(*args, **kwargs) |
|
46 | super(Pattern, self).save(*args, **kwargs) | |
47 |
|
47 | |||
48 | ''' |
|
|||
49 | def __unicode__(self): |
|
48 | def __unicode__(self): | |
50 | return u'%s' % self.value |
|
49 | return u'%s' % self.value | |
51 |
|
|
50 | ||
52 |
|
51 | |||
53 | class AntennaUp(models.Model): |
|
52 | class AntennaUp(models.Model): | |
54 |
|
53 | |||
55 | pattern = models.ForeignKey(Pattern) |
|
54 | pattern = models.ForeignKey(Pattern) | |
56 | value = models.TextField() |
|
55 | value = models.TextField() | |
57 | tx = models.TextField() |
|
56 | tx = models.TextField() | |
58 | rx = models.TextField() |
|
57 | rx = models.TextField() | |
59 | ues = models.CharField(max_length=120) |
|
58 | ues = models.CharField(max_length=120) | |
60 | date_create = models.DateTimeField() |
|
59 | date_create = models.DateTimeField() | |
61 | date_modified = models.DateTimeField(null=True) |
|
60 | date_modified = models.DateTimeField(null=True) | |
62 | hits = models.PositiveIntegerField() |
|
61 | hits = models.PositiveIntegerField() | |
63 | state = models.PositiveSmallIntegerField() |
|
62 | state = models.PositiveSmallIntegerField() | |
64 |
|
63 | |||
65 | class Meta: |
|
64 | class Meta: | |
66 | db_table = "abs_antenna_up" |
|
65 | db_table = "abs_antenna_up" | |
67 |
|
66 | |||
68 | def save(self, *args, **kwargs): |
|
67 | def save(self, *args, **kwargs): | |
69 | if self.pk is None: |
|
68 | if self.pk is None: | |
70 | self.date_create = timezone.now() |
|
69 | self.date_create = timezone.now() | |
71 | self.hits = 0 |
|
70 | self.hits = 0 | |
72 | self.state = 1 |
|
71 | self.state = 1 | |
73 | else: |
|
72 | else: | |
74 | self.date_modified = timezone.now() |
|
73 | self.date_modified = timezone.now() | |
75 | super(AntennaUp, self).save(*args, **kwargs) |
|
74 | super(AntennaUp, self).save(*args, **kwargs) | |
76 |
|
75 | |||
77 | def __unicode__(self): |
|
76 | def __unicode__(self): | |
78 | return u'%s' % self.value |
|
77 | return u'%s' % self.value | |
79 |
|
78 | |||
80 |
|
79 | |||
81 | class AntennaDown(models.Model): |
|
80 | class AntennaDown(models.Model): | |
82 |
|
81 | |||
83 | pattern = models.ForeignKey(Pattern) |
|
82 | pattern = models.ForeignKey(Pattern) | |
84 | value = models.TextField() |
|
83 | value = models.TextField() | |
85 | tx = models.TextField() |
|
84 | tx = models.TextField() | |
86 | rx = models.TextField() |
|
85 | rx = models.TextField() | |
87 | ues = models.CharField(max_length=120) |
|
86 | ues = models.CharField(max_length=120) | |
88 | date_create = models.DateTimeField() |
|
87 | date_create = models.DateTimeField() | |
89 | date_modified = models.DateTimeField(null=True) |
|
88 | date_modified = models.DateTimeField(null=True) | |
90 | hits = models.PositiveIntegerField() |
|
89 | hits = models.PositiveIntegerField() | |
91 | state = models.PositiveSmallIntegerField() |
|
90 | state = models.PositiveSmallIntegerField() | |
92 |
|
91 | |||
93 | class Meta: |
|
92 | class Meta: | |
94 | db_table = "abs_antenna_down" |
|
93 | db_table = "abs_antenna_down" | |
95 |
|
94 | |||
96 | def save(self, *args, **kwargs): |
|
95 | def save(self, *args, **kwargs): | |
97 | if self.pk is None: |
|
96 | if self.pk is None: | |
98 | self.date_create = timezone.now() |
|
97 | self.date_create = timezone.now() | |
99 | self.hits = 0 |
|
98 | self.hits = 0 | |
100 | self.state = 1 |
|
99 | self.state = 1 | |
101 | else: |
|
100 | else: | |
102 | self.date_modified = timezone.now() |
|
101 | self.date_modified = timezone.now() | |
103 | super(AntennaDown, self).save(*args, **kwargs) |
|
102 | super(AntennaDown, self).save(*args, **kwargs) | |
104 |
|
103 | |||
105 | def __unicode__(self): |
|
104 | def __unicode__(self): | |
106 | return u'%s' % self.value |
|
105 | return u'%s' % self.value |
General Comments 0
You need to be logged in to leave comments.
Login now