-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Facebook authorization and base profile logged users.
- Loading branch information
Showing
7 changed files
with
140 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
from django.contrib import admin | ||
from django.contrib.auth import admin as auth_admin | ||
from django.contrib.auth.models import User | ||
|
||
from .models import StProfile | ||
|
||
class StProfileInline(admin.StackedInline): | ||
# class StProfileInline(admin.TabularInline): | ||
model = StProfile | ||
|
||
class UserAdmin(auth_admin.UserAdmin): | ||
inlines = ( | ||
StProfileInline, | ||
) | ||
|
||
# replace existing User admin form | ||
admin.site.unregister(User) | ||
admin.site.register(User, UserAdmin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
from django.db import models | ||
from django.contrib.auth.models import User | ||
from django.utils.translation import ugettext as _ | ||
|
||
|
||
class StProfile(models.Model): | ||
"""To keep extra user data""" | ||
# user mapping | ||
user = models.OneToOneField(User) | ||
|
||
class Meta(object): | ||
verbose_name = _(u"User Profile") | ||
|
||
# extra user data | ||
mobile_phone = models.CharField( | ||
max_length=12, | ||
blank=True, | ||
verbose_name=_(u"Mobile Phone"), | ||
default='') | ||
|
||
def __unicode__(self): | ||
return self.user.username | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{% extends "students/base.html" %} | ||
|
||
{% load i18n %} | ||
|
||
{% block meta_title %}{{ user.get_full_name|default:user.username }}{% endblock meta_title %} | ||
|
||
{% block title %}{{ user.get_full_name|default:user.username }}{% endblock title %} | ||
|
||
{# | ||
{% block status_message %} | ||
{% if form.errors %} | ||
<div class="alert alert-warning" role="alert"> | ||
{% if form.non_field_errors %} | ||
{{ form.non_field_errors.as_text }} | ||
{% else %} | ||
{% trans "Please, correct the following errors." %} | ||
{% endif %} | ||
</div> | ||
{% endif %} | ||
{% endblock %} #} | ||
|
||
{% block content %} | ||
|
||
<table class="table table-striped"> | ||
{% if user.email %} | ||
<tr> | ||
<td>{% trans "Email" %}:</td> | ||
<td>{{ user.email }}</td> | ||
</tr> | ||
{% endif %} | ||
{% if user.username %} | ||
<tr> | ||
<td>{% trans "Username" %}:</td> | ||
<td>{{ user.get_full_name }}</td> | ||
</tr> | ||
{% endif %} | ||
{% if user.date_joined %} | ||
<tr> | ||
<td>{% trans "Joined" %}:</td> | ||
<td>{{ user.date_joined }}</td> | ||
</tr> | ||
{% endif %} | ||
{% if user.stprofile.mobile_phone %} | ||
<tr> | ||
<td>{% trans "Mobile Phone" %}:</td> | ||
<td>{{ user.stprofile.mobile_phone }}</td> | ||
</tr> | ||
{% endif %} | ||
</table> | ||
|
||
{% endblock content %} | ||
|