Browse Source

Upload file with ModelForm in protocoloadm

pull/11/merge
Eduardo Edson Batista Cordeiro Alves 9 years ago
parent
commit
9f2f281e85
  1. 4
      protocoloadm/models.py
  2. 2
      protocoloadm/views.py

4
protocoloadm/models.py

@ -18,11 +18,11 @@ class TipoDocumentoAdministrativo(models.Model):
def get_docadm_media_path(instance, subpath, filename):
return './docadm/%s/%s/%s' % (instance.numero, subpath, filename)
return './docadm/%s/%s/%s' % (instance, subpath, filename)
def texto_upload_path(instance, filename):
return get_docadm_media_path(instance, 'docadm', filename)
return get_docadm_media_path(instance, 'DocAdm', filename)
class DocumentoAdministrativo(models.Model):

2
protocoloadm/views.py

@ -810,7 +810,7 @@ class DocumentoAcessorioAdministrativoView(FormMixin, GenericView):
doc_acessorio.data = form.cleaned_data['data']
doc_acessorio.autor = form.cleaned_data['autor']
doc_acessorio.assunto = form.cleaned_data['assunto']
doc_acessorio.arquivo = form.cleaned_data['arquivo']
doc_acessorio.arquivo = request.FILES['arquivo']
doc_acessorio.documento = DocumentoAdministrativo.objects.get(
id=kwargs['pk'])
doc_acessorio.save()

Loading…
Cancel
Save