Cannot display html file you want to view

Asked 2 years ago, Updated 2 years ago, 79 views

When I access the upload_save method, only base.html is displayed.Visit view.py to

default_save(request):

    photo_id = request.POST.get("p_id", "")

    if(photo_id):
        photoo_obj=Post.objects.get(id=photo_id)
    else:
        photoo_obj=Post()

    files=request.FILES.getlist("files[]")

    photoo_obj.image=files[0]
    photoo_obj.save()

    photos=Post.objects.all()
    context = {
        'photos'—photos,
    }
    return render(request, 'registration/accounts/photo.html', context)

I would like to see photo.html when I access the upload_save method.

For photo.html,

{%extends"registration/accounts/base.html"%}
{% block body%}
<div class="container">
    <h2class="page-header">{{photos.title}}</h2>
    <div class="row">
      <div class="col-xs-4">
        <img class="img-responsive" src="/media/{{photos.image}}">
      </div>
    </div>
    <a class="btn btn-primary" href="{%url' accounts:upload'photo.id%}">bulk up</a>
</div>
{% endblock%}

I wrote.When I looked at Elements using Google's verification, only base.html was displayed.How can I fix it?

python html django

2022-09-30 16:12

1 Answers

base.html does not contain the contents of base.html but {%blockbody%}{%endblock%}.


2022-09-30 16:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.