This commit is contained in:
zalun 2010-02-17 02:28:50 +00:00
Родитель 0af160a474
Коммит aef1a0a553
3 изменённых файлов: 50 добавлений и 3 удалений

Просмотреть файл

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% load jetpack_extras %}
{% block app_body %}
<h1>Your dashboard</h1>
<p>Welcome {{ user }}<p>
<p>
Go to your <a href="{% url person_public_profile_forced user.username %}">public profile</a>
</p>
{% if user.authored_jetpacks.all %}
Your Jetpacks:
<ul>
{% for jet in user.authored_jetpacks.all %}
<li>{{ jet|render_base_link }}</li>
{% endfor %}
</ul>
{% endif %}
{% if user.authored_capabilities.all %}
Your Modules:
<ul>
{% for cap in user.authored_capabilities.all %}
<li>{{ cap|render_base_link }}</li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

Просмотреть файл

@ -5,6 +5,8 @@ from django.contrib.auth.views import login, logout
urlpatterns = patterns('person.views',
url(r'^login/$', login, name='login'),
url(r'^logout/$', logout, {"next_page": "/"}, name='logout'),
url(r'dashboard/$','dashboard', name='person_dashboard'),
url(r'^public/(?P<username>\w+)/$','public_profile', {"force": True}, name='person_public_profile_forced'),
url(r'^(?P<username>\w+)/$','public_profile', name='person_public_profile'),
)

Просмотреть файл

@ -1,11 +1,28 @@
from django.shortcuts import render_to_response, get_object_or_404
from django.http import Http404, HttpResponseRedirect, HttpResponse
from django.http import Http404, HttpResponseRedirect, HttpResponse, HttpResponseRedirect
from django.template import RequestContext#,Template
from django.contrib.auth.models import User
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from person.models import Profile
#from person.default_settings import settings
def public_profile(r, username):
def public_profile(r, username, force=None):
"""
Public profile
"""
person = get_object_or_404(User, username=username)
return HttpResponse("Here profile of %s" % str(person))
# if owner of the profile and not specially wanted to see it - redirect to dashboard
if not force and username == r.user.username:
return HttpResponseRedirect(reverse('person_dashboard'))
return render_to_response("profile.html", locals(),
context_instance=RequestContext(r))
@login_required
def dashboard(r):
"""
Dashboard of the user
"""
return render_to_response("dashboard.html", {},
context_instance=RequestContext(r))