Fixed profile page
This commit is contained in:
parent
6f2043acf0
commit
a12f419a47
|
@ -63,15 +63,18 @@ class LogoutView(View):
|
|||
|
||||
|
||||
class ProfileView(View):
|
||||
template = 'users/profile/{}.html'
|
||||
tempalte = 'users/profile.html'
|
||||
template_section = 'users/profile/{}.html'
|
||||
|
||||
def get(self, request, section='summary'):
|
||||
if request.user.is_authenticated():
|
||||
data = {
|
||||
'item': User.objects.get(pk=request.user.pk)
|
||||
}
|
||||
|
||||
template = self.template.format(section)
|
||||
if section != 'summary':
|
||||
template = self.template_section.format(section)
|
||||
else:
|
||||
template = self.tempalte
|
||||
data = self.get_context_from_section(request, section, data)
|
||||
|
||||
ctx = RequestContext(request, data)
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<img src="{{ item.avatar }}" class="max-width-100" />
|
||||
</div>
|
||||
<div class="list-group">
|
||||
<a href="{% url 'profile' %}" data-pjax="profile" class="list-group-item active">
|
||||
<a href="{% url 'profile' %}" data-pjax class="list-group-item active">
|
||||
{% trans "Summary" %}</a>
|
||||
<a href="{% url 'profile' 'collection' %}" data-pjax="profile" class="list-group-item">
|
||||
{% trans "Collection" %}</a>
|
||||
|
@ -35,7 +35,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-sm-9" data-pjax-container="profile">
|
||||
{% block profile_content %}{% endblock %}
|
||||
{% block profile_content %}
|
||||
{% include "users/profile/summary.html" %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
{% comment %}
|
||||
{% extends 'users/profile.html'|pjax:request %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block page_title %}{{ block.super }}{% endblock %}
|
||||
{% endcomment %}
|
||||
|
||||
{% block profile_content %}
|
||||
<div class="well">
|
||||
|
|
Reference in New Issue