
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.store.models import StoreItem


class StoreItemForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(StoreItemForm, self).__init__(*args, **kwargs)
        self.fields['event'].required = True
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                u'Tuote',
                'event',
                'name',
                'description',
                'price',
                'max',
                'available',
                'max_per_order',
                'delivery_type',
                'imagefile_original',
                ButtonHolder(
                    Submit('submit', u'Tallenna')
                )
            )
        )

    class Meta:
        model = StoreItem
        exclude = ('imagefile_thumbnail',)


from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.store.models import StoreItem

class StoreItemForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(StoreItemForm, self).__init__(*args, **kwargs)
        self.fields['event'].required = True
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                u'Tuote',
                'event',
                'name',
                'description',
                'price',
                'max',
                'available',
                'max_per_order',
                'imagefile_original',
                ButtonHolder(
                    Submit('submit', u'Tallenna')
                )
            )
        )

    class Meta:
        model = StoreItem
        exclude = ('imagefile_thumbnail',)

Remove deprecated fields from form
admin_store: Remove deprecated fields from form

  
  from django import forms
  from crispy_forms.helper import FormHelper
  from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
  from Instanssi.store.models import StoreItem
- 
  
  class StoreItemForm(forms.ModelForm):
      def __init__(self, *args, **kwargs):
          super(StoreItemForm, self).__init__(*args, **kwargs)
          self.fields['event'].required = True
          self.helper = FormHelper()
          self.helper.layout = Layout(
              Fieldset(
                  u'Tuote',
                  'event',
                  'name',
                  'description',
                  'price',
                  'max',
                  'available',
                  'max_per_order',
-                 'delivery_type',
                  'imagefile_original',
                  ButtonHolder(
                      Submit('submit', u'Tallenna')
                  )
              )
          )
  
      class Meta:
          model = StoreItem
          exclude = ('imagefile_thumbnail',)
  
Remove deprecated fields from form
## Code Before:

from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.store.models import StoreItem


class StoreItemForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(StoreItemForm, self).__init__(*args, **kwargs)
        self.fields['event'].required = True
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                u'Tuote',
                'event',
                'name',
                'description',
                'price',
                'max',
                'available',
                'max_per_order',
                'delivery_type',
                'imagefile_original',
                ButtonHolder(
                    Submit('submit', u'Tallenna')
                )
            )
        )

    class Meta:
        model = StoreItem
        exclude = ('imagefile_thumbnail',)

## Instruction:
Remove deprecated fields from form
## Code After:

from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder
from Instanssi.store.models import StoreItem

class StoreItemForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(StoreItemForm, self).__init__(*args, **kwargs)
        self.fields['event'].required = True
        self.helper = FormHelper()
        self.helper.layout = Layout(
            Fieldset(
                u'Tuote',
                'event',
                'name',
                'description',
                'price',
                'max',
                'available',
                'max_per_order',
                'imagefile_original',
                ButtonHolder(
                    Submit('submit', u'Tallenna')
                )
            )
        )

    class Meta:
        model = StoreItem
        exclude = ('imagefile_thumbnail',)
