예제 #1
0
 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')
예제 #2
0
파일: forms.py 프로젝트: rdavydov/demozoo
	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')
예제 #3
0
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')
예제 #4
0
    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)
예제 #5
0
파일: forms.py 프로젝트: rdavydov/demozoo
	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
		)
예제 #6
0
 def test_graphic_types(self):
     ProductionType.objects.filter(internal_name='graphics').delete()
     self.assertEqual(ProductionType.graphic_types().count(), 0)
예제 #7
0
 def __init__(self, *args, **kwargs):
     super(GraphicsIndexFilterForm, self).__init__(*args, **kwargs)
     self.fields['production_type'].queryset = ProductionType.graphic_types(
     )
예제 #8
0
파일: forms.py 프로젝트: Gargaj/demozoo
	def __init__(self, *args, **kwargs):
		super(GraphicsIndexFilterForm, self).__init__(*args, **kwargs)
		self.fields['production_type'].queryset = ProductionType.graphic_types()