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