What does the form contain ?

Does the web page you get give you an upload button ?

Does the code in the view get triggered ?

Do you get any errors ?

On 13/05/18 04:23, [email protected] wrote:
 views

def ArticuloFormA(request,Materiaid):
    Articulos = Articulo.objects.filter(Materia_id= Materiaid)
    Articulos = Articulos.order_by('-Fecha_Publicacion')[:5]
    Pregunta_Form = ArticuloForm()
    args = {'Pregunta_Form': Pregunta_Form}
    if request.method == 'POST':
        form = ArticuloForm(request.POST or None, request.FILES or None)
        if form.is_valid():
            Materias = Materia.objects.get(id = Materiaid)
            Preguntad = form.save(commit=False)
            Preguntad.user = request.user
            Preguntad.Texto_Pregunta = request.POST['Titulo']
            Preguntad.Materia = Materias
            Preguntad.Pdf_articulo = request.FILES['Pdf_articulo']
            Preguntad.save()
            return render(request,'articulos/detail.html',{'Preguntas': Articulos,'Materias': Materias})
    else:
        Pregunta_Form = ArticuloForm()
        args = {'Pregunta_Form': Pregunta_Form}
    return render(request,'foro/FormPregunta.html',args)


html

{% extends 'cuentas/base.html' %}

                {% block body %}
                <div class="container">
                    <h1>CrearPregunta</h1>
                    <form method = "POST" enctype="multipart/form-data">
                        {% csrf_token %}
                        {{ Pregunta_Form.docfile }}
                        <button type="submit" class="btn btn-lg btn-success">Submit</button>
                    </form>
                </div>
                {% endblock %}

--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/353c96a5-5946-4530-beb4-71ad83c0366b%40googlegroups.com <https://groups.google.com/d/msgid/django-users/353c96a5-5946-4530-beb4-71ad83c0366b%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
--
Anthony Flury
email : *[email protected]*
Twitter : *@TonyFlury <https://twitter.com/TonyFlury/>*

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7c9a06eb-c51c-ac5f-8068-9bfffdd18686%40btinternet.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to