Пример #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
 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
    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
    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
    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))