Commit da4a8ddc authored by Brian Guadalupe's avatar Brian Guadalupe

Fix username mismatch in the templates

parent 1caae979
......@@ -7,10 +7,10 @@
</head>
<body>
<header>
{% if user.is_authenticated %}
{% if request.user.is_authenticated %}
<ul id='nav_bar'>
<li><a class="nav_bar_home" href="/">MyMusicList</a></li>
<li><a class="nav_bar_tab" href="/profile/{{user.username}}">Hi, {{user.username}}</a></li>
<li><a class="nav_bar_tab" href="/profile/{{request.user.username}}">Hi, {{request.user.username}}</a></li>
<li style="float:right"><a class="nav_bar_tab" href="{% url 'logout' %}">Logout</a></li>
</ul>
{% else %}
......
......@@ -5,6 +5,7 @@
{% block content %}
<div class="boxified main profile">
{% 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 %}">
......@@ -12,6 +13,9 @@
{{ 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 %}
......
......@@ -33,6 +33,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce vel tristique ris
Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Mauris suscipit nec velit non egestas. Quisque auctor viverra urna, at euismod turpis ornare id. Aliquam pharetra purus quis dui blandit tincidunt. Quisque massa ligula, malesuada vel leo eu, accumsan vulputate nulla. Integer faucibus malesuada pharetra. Duis varius sapien sit amet justo malesuada fringilla. Integer eget ex sed urna auctor vestibulum. Aliquam sit amet molestie velit, a pretium ligula. Mauris gravida turpis vitae scelerisque finibus.
</div>
{% if user.is_authenticated %}
{% if request.user.is_authenticated %}
{% endif %}
{% endblock %}
......@@ -7,7 +7,7 @@
<h2>Logged out</h2>
<p>
You have been successfully logged out. <br> Please login again.
You have been successfully logged out. <br> Go back to the <a href="{% url 'home' %}">home page</a>.
</p>
</div>
......
......@@ -5,9 +5,9 @@
{% block content %}
<div class="boxified main login_form">
{% if user.is_authenticated %}
<p>You are already logged in as {{user.username}}. You need to log out before logging in as a different user.</p>
<p><a href="/logout">Log out</a> or <a href="/">return to home page</a>.</p>
{% if request.user.is_authenticated %}
<p>You are already logged in as {{request.user.username}}. You need to log out before logging in as a different user.</p>
<p><a href="/logout">Log out</a> or <a href="/">return to the home page</a>.</p>
{% else %}
<h2>Login</h2>
<form method="post">
......
......@@ -11,7 +11,7 @@
<li><strong>Last Name:</strong> {{profile.last_name}}</li>
<li><strong>Email Address:</strong> {{profile.email}}</li>
</ul>
{% if profile.username == request.user.username and request.user.is_authenticated %}
{% if profile.username == request.user.username %}
<a href="edit" class="buttoned">Edit user profile</a>
{% endif %}
{% else %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment