Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added a very rudimentary user profile page.

It's a start, I guess.
  • Loading branch information...
commit f0a023c076560d4aec4623e27e8279f979e1eb3f 1 parent fc9a700
@jacobian jacobian authored
View
13 django_website/accounts/urls.py
@@ -1,21 +1,22 @@
-from django.conf.urls.defaults import *
-from django.views.generic.simple import direct_to_template
+from __future__ import absolute_import
+
+from django.conf.urls.defaults import patterns, url, include
from registration.forms import RegistrationFormUniqueEmail
urlpatterns = patterns('',
url(
- r'^register/$',
- "registration.views.register",
+ r'^register/$',
+ "registration.views.register",
{'form_class': RegistrationFormUniqueEmail},
name='registration_register',
),
url(
- r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
+ r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',
'django.contrib.auth.views.password_reset_confirm',
name='auth_password_reset_confim',
),
url(
- r'^reset/done/$',
+ r'^reset/done/$',
'django.contrib.auth.views.password_reset_complete'
),
(r'', include('registration.urls')),
View
7 django_website/accounts/views.py
@@ -0,0 +1,7 @@
+from django.shortcuts import render, get_object_or_404
+from django.contrib.auth.models import User
+
+def user_profile(request, username):
+ u = get_object_or_404(User, username=username)
+ ctx = {'user': u, 'user_can_commit': u.has_perm('auth.commit')}
+ return render(request, "accounts/user_profile.html", ctx)
View
20 django_website/templates/accounts/user_profile.html
@@ -0,0 +1,20 @@
+{% extends "base_community.html" %}
+
+{% block title %}{{ user }} | djangoproject.com{% endblock %}
+{% block content-related %}{% endblock %}
+
+{% block content %}
+ <h1>{% firstof user.get_full_name user.username %}</h1>
+ <p>Member since {{ user.date_joined.date }}.</p>
+ {% if user_can_commit %}<p>Committer!</p>{% endif %}
+ {% with user.owned_feeds.all as feeds %}
+ {% if feeds %}
+ <h2>Community feeds:</h2>
+ <li>
+ {% for f in feeds %}
+ <li><a href="{{ f.public_url }}">{{ f.title }}</a></li>
+ {% endfor %}
+ </li>
+ {% endif %}
+ {% endwith %}
+{% endblock content %}
View
10 django_website/urls/www.py
@@ -1,16 +1,16 @@
from __future__ import absolute_import
from django.conf import settings
-from django.conf.urls.defaults import *
-from django.contrib import admin; admin.autodiscover()
+from django.conf.urls.defaults import patterns, include, url
+from django.contrib import admin
from django.contrib.comments.feeds import LatestCommentFeed
from django.contrib.comments.models import Comment
from django.contrib.flatpages.views import flatpage
from django.contrib.sitemaps import views as sitemap_views
from django.views.decorators.cache import cache_page
from django.views.generic.simple import redirect_to
+from ..accounts import views as account_views
from ..aggregator.feeds import CommunityAggregatorFeed, CommunityAggregatorFirehoseFeed
-from ..aggregator.models import FeedItem
from ..blog.feeds import WeblogEntryFeed
from ..sitemaps import FlatPageSitemap, WeblogSitemap
@@ -34,6 +34,10 @@
url(r'^contact/', include('django_website.contact.urls')),
url(r'^r/', include('django.conf.urls.shortcut')),
+ # There's no school like the old school.
+ url(r'^~(?P<username>[\w-]+)/$', account_views.user_profile, name='user_profile'),
+
+ # Feeds
url(r'^rss/weblog/$', WeblogEntryFeed(), name='weblog-feed'),
url(r'^rss/comments/$', LatestCommentFeed(), name='comments-feed'),
url(r'^rss/community/$', redirect_to, {'url': '/rss/community/blogs/'}),
Please sign in to comment.
Something went wrong with that request. Please try again.