Rizwan Haider | 51fdb3f | 2016-11-09 18:29:32 -0500 | [diff] [blame] | 1 | from core.admin import XOSBaseAdmin |
| 2 | from django.contrib import admin |
| 3 | from services.vnodlocal.models import * |
| 4 | from django import forms |
| 5 | |
| 6 | class VnodLocalServiceAdmin(XOSBaseAdmin): |
| 7 | verbose_name = "VNOD Local Service" |
| 8 | verbose_name_plural = "VNOD Local Services" |
| 9 | list_display = ('servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 10 | list_display_links = ('servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 11 | |
| 12 | fields = ('id', 'servicehandle', 'portid', 'vlanid', 'administrativeState', 'operstate', 'autoattached') |
| 13 | readonly_fields = ('id','autoattached') |
| 14 | |
| 15 | |
| 16 | class VnodLocalSystemAdminForm(forms.ModelForm): |
| 17 | |
| 18 | password = forms.CharField(required=False, widget = forms.PasswordInput(render_value=True)) |
| 19 | |
| 20 | class Meta: |
| 21 | model = VnodLocalSystem |
| 22 | fields = '__all__' |
| 23 | |
| 24 | class VnodLocalSystemAdmin(XOSBaseAdmin): |
| 25 | verbose_name = "VNOD Local System" |
| 26 | verbose_name_plural = "VNOD Local Systems" |
| 27 | form = VnodLocalSystemAdminForm |
| 28 | list_display = ('name', 'administrativeState', 'restUrl', 'username', 'pseudowireprovider', 'networkControllerUrl') |
| 29 | list_display_links = ('name', 'administrativeState', 'restUrl', 'username', 'pseudowireprovider', 'networkControllerUrl') |
| 30 | |
| 31 | fields = ('name', 'administrativeState', 'restUrl', 'username', 'password', 'pseudowireprovider', 'networkControllerUrl') |
| 32 | |
| 33 | class VnodLocalPseudowireConnectorServiceAdmin(XOSBaseAdmin): |
| 34 | verbose_name = "VNOD Local Pseudowire Connector Service" |
| 35 | verbose_name_plural = "VNOD Local Pseudowire Connector Service" |
| 36 | list_display = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 37 | list_display_links = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 38 | |
| 39 | fields = ('servicehandle', 'internalport', 'pseudowirehandle','vnodlocal', 'administrativeState', 'operstate') |
| 40 | readonly_fields = ('vnodlocal', 'operstate', 'pseudowirehandle') |
| 41 | |
| 42 | |
| 43 | admin.site.register(VnodLocalSystem, VnodLocalSystemAdmin) |
| 44 | admin.site.register(VnodLocalService, VnodLocalServiceAdmin) |
| 45 | admin.site.register(VnodLocalPseudowireConnectorService, VnodLocalPseudowireConnectorServiceAdmin) |
| 46 | |
| 47 | |