def __init__(self, *args, **kwargs): super(CreateGraphicsForm, self).__init__(*args, **kwargs) self.fields['type'] = ProductionTypeChoiceField( queryset=ProductionType.graphic_types(), initial=ProductionType.objects.get(internal_name='graphics')) self.fields['platform'] = forms.ModelChoiceField( required=False, queryset=Platform.objects.all(), empty_label='Any')
def __init__(self, *args, **kwargs): super(CreateGraphicsForm, self).__init__(*args, **kwargs) self.fields['type'] = ProductionTypeChoiceField( queryset=ProductionType.graphic_types(), initial=ProductionType.objects.get(internal_name='graphics') ) self.fields['platform'] = forms.ModelChoiceField(required=False, queryset=Platform.objects.all(), empty_label='Any')
class GraphicsIndexFilterForm(forms.Form): platform = forms.ModelChoiceField(required=False, queryset=Platform.objects.all(), empty_label='All platforms') production_type = ProductionTypeChoiceField( required=False, queryset=ProductionType.graphic_types(), empty_label='All types')
def __init__(self, *args, **kwargs): super(GraphicsEditCoreDetailsForm, self).__init__(*args, **kwargs) self.has_multiple_types = False try: initial_type = self.instance.types.all()[0].id except IndexError: initial_type = None self.fields['type'] = ProductionTypeChoiceField( queryset=ProductionType.graphic_types(), initial=initial_type)
def __init__(self, *args, **kwargs): super(GraphicsEditCoreDetailsForm, self).__init__(*args, **kwargs) self.has_multiple_types = False try: initial_type = self.instance.types.all()[0].id except IndexError: initial_type = None self.fields['type'] = ProductionTypeChoiceField( queryset=ProductionType.graphic_types(), initial=initial_type )
def test_graphic_types(self): ProductionType.objects.filter(internal_name='graphics').delete() self.assertEqual(ProductionType.graphic_types().count(), 0)
def __init__(self, *args, **kwargs): super(GraphicsIndexFilterForm, self).__init__(*args, **kwargs) self.fields['production_type'].queryset = ProductionType.graphic_types( )
def __init__(self, *args, **kwargs): super(GraphicsIndexFilterForm, self).__init__(*args, **kwargs) self.fields['production_type'].queryset = ProductionType.graphic_types()