Profileapp 마무리 (작정하고 장고 32강)

_upper·2023년 5월 24일

32강

Profileapp의 UpdateView 를 만들면서 Profileapp 구축 마무리를 진행한다.

    path('admin/', admin.site.urls),
    path('accounts/', include('accountapp.urls')),
    path('profiles/', include('profileapp.urls')),
    static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

path 뿐만아니라 추가적으로 medai와 연결시켜서 계속 저장하게 함

{% extends 'base.html' %}
{% load bootstrap4 %}

{% block content %}

    <div style="text-align:center; max-width: 500px; margin: 4rem auto">
        <div class="mb-4">
            <h4>Change Info</h4>
        </div>
        <form action="{% url 'profileapp:update' pk=target_profile.pk %}" method="post" enctype="multipart/form-data">
            {% csrf_token %}
            {% bootstrap_form form %}
            <input type="submit" class="btn btn-dark rounded-pill col-6 mt-3>
        </form>
    </div>

{% endblock %}

update.html 추가

@method_decorator(profile_ownership_required, 'get')
@method_decorator(profile_ownership_required, 'post')

profielapp/views.py 에서 코드 추가
보안사항

0개의 댓글