{% extends 'base.html' %}

{% block title %}Edit Profile{% endblock %}



{% block sidebar %}
{% endblock %}

{% block content %}
<div class="w3-card-4 w3-green  w3-padding">
{% if request.user.is_authenticated %}
{% if user.username == request.user.username %}
    <h2>Edit Profile</h2>
    <!-- <form method="post"> -->
    <form method="post" action="{% url 'editprofile' slug=user.username %}">
        {% csrf_token %}
        {{ form.as_p }}
        <button type="submit" class="buttoned">Save changes</button>
    </form>
{% else %}
    <p>You can only edit your own user profile.  Go to your own <a href="{% url 'viewprofile' slug=request.user.username %}">profile page</a>.</p>
{% endif %}
{% else %}
    <p>Please <a href="{% url 'login' %}">log in</a> to your account to edit your profile.</p>
{% endif %}
</div>
{% endblock %}
