Rizwan Haider | 30b3379 | 2016-08-18 02:11:18 -0400 | [diff] [blame^] | 1 | # models.py - Metro Network Service |
| 2 | |
| 3 | from django.db import models |
| 4 | from core.models import Service |
| 5 | |
| 6 | METRONETWORK_KIND = "metronetwork" |
| 7 | SERVICE_NAME = 'metronetwork' |
| 8 | SERVICE_NAME_VERBOSE = 'Metro Network Service' |
| 9 | |
| 10 | class MetroNetworkService(Service): |
| 11 | |
| 12 | KIND = METRONETWORK_KIND |
| 13 | |
| 14 | class Meta: |
| 15 | app_label = SERVICE_NAME |
| 16 | verbose_name = SERVICE_NAME_VERBOSE |
| 17 | |
| 18 | ADMINISTRATIVE_STATE = ( |
| 19 | ('enabled', 'Enabled'), |
| 20 | ('disabled', 'Disabled') |
| 21 | ) |
| 22 | |
| 23 | OPERATIONALSTATE = ( |
| 24 | ('active', 'Active'), |
| 25 | ('inactive', 'Inactive') |
| 26 | ) |
| 27 | |
| 28 | restUrl = models.CharField(verbose_name="Rest URL", |
| 29 | max_length=256, |
| 30 | editable=True) |
| 31 | |
| 32 | administrativeState = models.CharField(choices=ADMINISTRATIVE_STATE, |
| 33 | default='disabled', |
| 34 | verbose_name="AdministrativeState", |
| 35 | max_length=16, |
| 36 | editable=True) |
| 37 | |
| 38 | operationalState = models.CharField(choices=OPERATIONALSTATE, |
| 39 | verbose_name="OperationalState", |
| 40 | max_length=256, |
| 41 | editable=True) |
| 42 | |
| 43 | def __init__(self, *args, **kwargs): |
| 44 | super(MetroNetworkService, self).__init__(*args, **kwargs) |
| 45 | |
| 46 | def getAdminstrativeState(self): |
| 47 | return self.administrativeState |
| 48 | |
| 49 | def setAdminstrativeState(self, value): |
| 50 | self.administrativeState = value |
| 51 | |
| 52 | def getOperationalState(self): |
| 53 | return self.operationalState |
| 54 | |
| 55 | def getRestUrl(self): |
| 56 | return self.restUrl |