def __init__(self, *args, **kwargs): super(OrderItemForm, self).__init__(*args, **kwargs) if self.instance: product = self.instance.product if product.can_order_from_gsx(): CODES = symptom_codes(product.component_code) self.fields['comptia_code'] = forms.ChoiceField(choices=CODES) self.fields['comptia_modifier'] = forms.ChoiceField( choices=gsxws.MODIFIERS, initial="B" )
def __init__(self, *args, **kwargs): super(OrderItemForm, self).__init__(*args, **kwargs) if self.instance: product = self.instance.product if product.can_order_from_gsx(): CODES = symptom_codes(product.component_code) self.fields['comptia_code'] = forms.ChoiceField( choices=CODES, label=_('Symptom code')) self.fields['comptia_modifier'] = forms.ChoiceField( choices=gsxws.MODIFIERS, initial="B", label=_('Symptom modifier'))
def comptia_choices(self): if self.product is not None: from servo.models.parts import symptom_codes return symptom_codes(self.product.component_code)