|
@ -1,6 +1,7 @@ |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import HTML, Button, Column, Div, Field, Layout, Row |
|
|
from crispy_forms.layout import HTML, Button, Column, Div, Field, Layout, Row |
|
|
from django import forms |
|
|
from django import forms |
|
|
|
|
|
from django.core.exceptions import NON_FIELD_ERRORS |
|
|
from django.forms.models import ModelForm |
|
|
from django.forms.models import ModelForm |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
@ -14,7 +15,7 @@ class UpLoadImportFileForm(forms.Form): |
|
|
required=True, |
|
|
required=True, |
|
|
label=_('Arquivo formato ODF para Importanção')) |
|
|
label=_('Arquivo formato ODF para Importanção')) |
|
|
|
|
|
|
|
|
error_messages = { |
|
|
nota_error_messages = { |
|
|
'required': _('Este campo é obrigatório'), |
|
|
'required': _('Este campo é obrigatório'), |
|
|
'invalid': _('URL inválida.') |
|
|
'invalid': _('URL inválida.') |
|
|
} |
|
|
} |
|
@ -37,11 +38,11 @@ class NotaForm(ModelForm): |
|
|
texto = forms.CharField( |
|
|
texto = forms.CharField( |
|
|
label='', |
|
|
label='', |
|
|
widget=forms.Textarea, |
|
|
widget=forms.Textarea, |
|
|
error_messages=error_messages) |
|
|
error_messages=nota_error_messages) |
|
|
url_externa = forms.URLField( |
|
|
url_externa = forms.URLField( |
|
|
label='', |
|
|
label='', |
|
|
required=False, |
|
|
required=False, |
|
|
error_messages=error_messages) |
|
|
error_messages=nota_error_messages) |
|
|
publicidade = forms.ChoiceField( |
|
|
publicidade = forms.ChoiceField( |
|
|
required=True, |
|
|
required=True, |
|
|
label=_('Publicidade'), |
|
|
label=_('Publicidade'), |
|
@ -60,7 +61,7 @@ class NotaForm(ModelForm): |
|
|
required=True, |
|
|
required=True, |
|
|
widget=forms.DateInput( |
|
|
widget=forms.DateInput( |
|
|
format='%d/%m/%Y'), |
|
|
format='%d/%m/%Y'), |
|
|
error_messages=error_messages |
|
|
error_messages=nota_error_messages |
|
|
) |
|
|
) |
|
|
efetividade = forms.DateField( |
|
|
efetividade = forms.DateField( |
|
|
label=_('Efetividade'), |
|
|
label=_('Efetividade'), |
|
@ -68,7 +69,7 @@ class NotaForm(ModelForm): |
|
|
required=True, |
|
|
required=True, |
|
|
widget=forms.DateInput( |
|
|
widget=forms.DateInput( |
|
|
format='%d/%m/%Y'), |
|
|
format='%d/%m/%Y'), |
|
|
error_messages=error_messages) |
|
|
error_messages=nota_error_messages) |
|
|
dispositivo = forms.ModelChoiceField(queryset=Dispositivo.objects.all(), |
|
|
dispositivo = forms.ModelChoiceField(queryset=Dispositivo.objects.all(), |
|
|
widget=forms.HiddenInput()) |
|
|
widget=forms.HiddenInput()) |
|
|
pk = forms.IntegerField(widget=forms.HiddenInput(), |
|
|
pk = forms.IntegerField(widget=forms.HiddenInput(), |
|
@ -137,12 +138,12 @@ class VideForm(ModelForm): |
|
|
texto = forms.CharField( |
|
|
texto = forms.CharField( |
|
|
label='', |
|
|
label='', |
|
|
widget=forms.Textarea, |
|
|
widget=forms.Textarea, |
|
|
error_messages=error_messages, |
|
|
|
|
|
required=False) |
|
|
required=False) |
|
|
tipo = forms.ModelChoiceField( |
|
|
tipo = forms.ModelChoiceField( |
|
|
label=_('Tipo do Vide'), |
|
|
label=_('Tipo do Vide'), |
|
|
queryset=TipoVide.objects.all(), |
|
|
queryset=TipoVide.objects.all(), |
|
|
required=True) |
|
|
required=True, |
|
|
|
|
|
error_messages=nota_error_messages) |
|
|
|
|
|
|
|
|
busca_dispositivo = forms.CharField( |
|
|
busca_dispositivo = forms.CharField( |
|
|
label=_('Buscar Dispositivo a Referenciar'), |
|
|
label=_('Buscar Dispositivo a Referenciar'), |
|
@ -157,6 +158,12 @@ class VideForm(ModelForm): |
|
|
'texto', |
|
|
'texto', |
|
|
'tipo', |
|
|
'tipo', |
|
|
'pk'] |
|
|
'pk'] |
|
|
|
|
|
error_messages = { |
|
|
|
|
|
NON_FIELD_ERRORS: { |
|
|
|
|
|
'unique_together': |
|
|
|
|
|
"Ja existe um Vide deste tipo para o Dispositivo Referido ", |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|