|
@ -307,14 +307,14 @@ class ProtocoloMateriaForm(ModelForm): |
|
|
autor = forms.IntegerField(widget=forms.HiddenInput(), required=False) |
|
|
autor = forms.IntegerField(widget=forms.HiddenInput(), required=False) |
|
|
|
|
|
|
|
|
def clean_autor(self): |
|
|
def clean_autor(self): |
|
|
data_autor = self.cleaned_data['autor'] |
|
|
autor_field = self.cleaned_data['autor'] |
|
|
try: |
|
|
try: |
|
|
autor = Autor.objects.get(id=data_autor) |
|
|
autor = Autor.objects.get(id=autor_field) |
|
|
except ObjectDoesNotExist: |
|
|
except ObjectDoesNotExist: |
|
|
data_autor = None |
|
|
autor_field = None |
|
|
else: |
|
|
else: |
|
|
data_autor = autor |
|
|
autor_field = autor |
|
|
return data_autor |
|
|
return autor_field |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
|
model = Protocolo |
|
|
model = Protocolo |
|
|