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