class CancelacionForm(ContratoMixin): class Meta: model = Cancelacion fecha = forms.DateField(widget=FutureDateWidget(), required=False, initial=timezone.now().date()) def __init__(self, *args, **kwargs): super(CancelacionForm, self).__init__(*args, **kwargs) self.helper.layout = Fieldset(u'Cancelar Contrato', *self.field_names)
class MetaForm(FieldSetModelFormMixin): class Meta: model = Meta fecha = forms.DateField(widget=FutureDateWidget(), required=False, initial=timezone.now().date()) def __init__(self, *args, **kwargs): super(MetaForm, self).__init__(*args, **kwargs) self.helper.layout = Fieldset(u'Formulario de Meta', *self.field_names)
class ContratoEmpresarialForm(FieldSetModelFormMixin): class Meta: model = Contrato exclude = ('cancelado',) vencimiento = forms.DateField(widget=FutureDateWidget) ultimo_pago = forms.DateTimeField(widget=DateTimeWidget(), required=False, initial=timezone.now) inicio = forms.DateField(widget=FutureDateWidget()) def __init__(self, *args, **kwargs): super(ContratoEmpresarialForm, self).__init__(*args, **kwargs) self.helper.layout = Fieldset(u'Formulario de Contrato', *self.field_names)
class ItemForm(FieldSetModelFormMixin): class Meta: model = Item fields = ("inventario", "plantilla", "cantidad", 'vencimiento') plantilla = ModelChoiceField( name="", model="", label="Item", queryset=ItemTemplate.objects.filter( activo=True).order_by('descripcion').all()) vencimiento = forms.DateTimeField(widget=FutureDateWidget()) def __init__(self, *args, **kwargs): super(ItemForm, self).__init__(*args, **kwargs) self.helper.layout = Fieldset(u'Formulario de Item Inventariado', *self.field_names)