示例#1
0
 def test_get_volume_status_choices_without_current(self):
     current_status = 'available'
     status_choices = forms.populate_status_choices(current_status,
                                                    forms.STATUS_CHOICES)
     self.assertEqual(len(status_choices), len(forms.STATUS_CHOICES))
     self.assertNotIn(current_status,
                      [status[0] for status in status_choices])
示例#2
0
文件: tests.py 项目: andymcc/horizon
 def test_get_volume_status_choices_without_current(self):
     current_status = 'available'
     status_choices = forms.populate_status_choices(current_status,
                                                    forms.STATUS_CHOICES)
     self.assertEqual(len(status_choices), len(forms.STATUS_CHOICES))
     self.assertNotIn(current_status,
                      [status[0] for status in status_choices])
示例#3
0
文件: forms.py 项目: stackhpc/horizon
    def __init__(self, request, *args, **kwargs):
        current_status = kwargs['initial']['status']
        kwargs['initial'].pop('status')

        super().__init__(request, *args, **kwargs)

        self.fields['status'].choices = populate_status_choices(
            current_status, STATUS_CHOICES)
示例#4
0
    def __init__(self, request, *args, **kwargs):
        # Initial values have to be operated before super() otherwise the
        # initial values will get overwritten back to the raw value
        current_status = kwargs['initial']['status']
        kwargs['initial'].pop('status')

        super().__init__(request, *args, **kwargs)

        self.fields['status'].choices = populate_status_choices(
            current_status, STATUS_CHOICES)
示例#5
0
文件: forms.py 项目: CCI-MOC/horizon
    def __init__(self, request, *args, **kwargs):
        # Initial values have to be operated before super() otherwise the
        # initial values will get overwritten back to the raw value
        current_status = kwargs['initial']['status']
        kwargs['initial'].pop('status')

        super(UpdateStatus, self).__init__(request, *args, **kwargs)

        self.fields['status'].choices = populate_status_choices(
            current_status, STATUS_CHOICES)
示例#6
0
    def __init__(self, request, *args, **kwargs):
        # Obtain the localized status to use as initial value, has to be done
        # before super() otherwise the initial value will get overwritten back
        # to the raw value
        current_status = kwargs['initial']['status']
        choices = dict(STATUS_CHOICES)
        kwargs['initial']['status'] = choices[current_status]

        super(UpdateStatus, self).__init__(request, *args, **kwargs)

        self.fields['status'].choices = populate_status_choices(
            current_status, STATUS_CHOICES)
示例#7
0
文件: forms.py 项目: amotoki/horizon
    def __init__(self, request, *args, **kwargs):
        # Obtain the localized status to use as initial value, has to be done
        # before super() otherwise the initial value will get overwritten back
        # to the raw value
        current_status = kwargs['initial']['status']
        choices = dict(STATUS_CHOICES)
        kwargs['initial']['status'] = choices[current_status]

        super(UpdateStatus, self).__init__(request, *args, **kwargs)

        self.fields['status'].choices = populate_status_choices(
            current_status, STATUS_CHOICES)
示例#8
0
    def __init__(self, request, *args, **kwargs):
        super(UpdateStatus, self).__init__(request, *args, **kwargs)

        initial = kwargs.get('initial', {})
        self.fields['status'].choices = (populate_status_choices(
            initial, STATUS_CHOICES))