Matteo Scandolo | a86e0a1 | 2017-08-08 13:05:27 -0700 | [diff] [blame^] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Sapan Bhatia | 084c098 | 2017-04-21 14:47:40 +0200 | [diff] [blame] | 17 | sync_attributes = ( 'test', 'argument', "scope" ) |
| 18 | |
| 19 | def __init__(self, *args, **kwargs): |
Scott Baker | 379404c | 2017-05-24 17:13:45 -0700 | [diff] [blame] | 20 | vtr_services = VTRService.objects.all() |
Sapan Bhatia | 084c098 | 2017-04-21 14:47:40 +0200 | [diff] [blame] | 21 | if vtr_services: |
Scott Baker | c7958a9 | 2017-07-18 11:07:00 -0700 | [diff] [blame] | 22 | self._meta.get_field("owner").default = vtr_services[0].id |
Sapan Bhatia | 084c098 | 2017-04-21 14:47:40 +0200 | [diff] [blame] | 23 | super(VTRTenant, self).__init__(*args, **kwargs) |
| 24 | |
| 25 | def save(self, *args, **kwargs): |
| 26 | super(VTRTenant, self).save(*args, **kwargs) |
| 27 | |
| 28 | def delete(self, *args, **kwargs): |
| 29 | super(VTRTenant, self).delete(*args, **kwargs) |
| 30 | |