Spaces:
Running
Running
Refactorizacion de basic forms para evitar errores al migrar a db externa
Browse files
tecnicas/forms/sesion_basic_form.py
CHANGED
|
@@ -28,14 +28,6 @@ class SesionBasicForm(forms.Form):
|
|
| 28 |
"placeholder": "Solo números"
|
| 29 |
}), required=True)
|
| 30 |
|
| 31 |
-
estilo_palabras = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
| 32 |
-
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 33 |
-
}), required=True, initial=EstiloPalabra.objects.first())
|
| 34 |
-
|
| 35 |
-
tipo_escala = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
|
| 36 |
-
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 37 |
-
}), required=True, initial=TipoEscala.objects.first())
|
| 38 |
-
|
| 39 |
tamano_escala = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 40 |
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 41 |
}), required=True, min_value=5)
|
|
@@ -48,6 +40,14 @@ class SesionBasicForm(forms.Form):
|
|
| 48 |
def __init__(self, *args, id_tecnica_new=0, **kwargs):
|
| 49 |
super().__init__(*args, **kwargs)
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
if id_tecnica_new != 0:
|
| 52 |
self.fields['id_tecnica'] = forms.IntegerField(
|
| 53 |
initial=id_tecnica_new, widget=forms.HiddenInput())
|
|
|
|
| 28 |
"placeholder": "Solo números"
|
| 29 |
}), required=True)
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
tamano_escala = forms.IntegerField(widget=forms.NumberInput(attrs={
|
| 32 |
"class": "bg-gray-200 p-1 border-b-1 text-center w-full",
|
| 33 |
}), required=True, min_value=5)
|
|
|
|
| 40 |
def __init__(self, *args, id_tecnica_new=0, **kwargs):
|
| 41 |
super().__init__(*args, **kwargs)
|
| 42 |
|
| 43 |
+
self.fields['estilo_palabras'] = forms.ModelChoiceField(queryset=EstiloPalabra.objects.all(), widget=forms.RadioSelect(attrs={
|
| 44 |
+
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 45 |
+
}), required=True, initial=EstiloPalabra.objects.first())
|
| 46 |
+
|
| 47 |
+
self.fields['tipo_escala'] = forms.ModelChoiceField(queryset=TipoEscala.objects.all(), widget=forms.RadioSelect(attrs={
|
| 48 |
+
"class": "uppercase text-lg tracking-wider font-medium p-2 px-4 active:px-5 transition-all rounded-xl bg-blue-500 text-white",
|
| 49 |
+
}), required=True, initial=TipoEscala.objects.first())
|
| 50 |
+
|
| 51 |
if id_tecnica_new != 0:
|
| 52 |
self.fields['id_tecnica'] = forms.IntegerField(
|
| 53 |
initial=id_tecnica_new, widget=forms.HiddenInput())
|