-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6314c66
Showing
18 changed files
with
235 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build/ | ||
dist/ | ||
django_keoh_userprofile.egg-info/ | ||
*.pyc |
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 @@ | ||
Copyright (c) 2014, Francisco Manzano Magaña | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
* Neither the name of Divio AG nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL DIVIO AG BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
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,6 @@ | ||
include LICENSE | ||
include README.rst | ||
recursive-include user_profile/templates * | ||
recursive-include user_profile/static * | ||
recursive-include docs * | ||
recursive-exclude * *.pyc |
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,31 @@ | ||
===== | ||
Keoh User Profile | ||
===== | ||
|
||
Keoh User Profile is a very simple app to use extended version of Django | ||
User model. | ||
|
||
Detailed documentation is in the "docs" directory. | ||
|
||
Quick start | ||
----------- | ||
|
||
1. Add "user_profile" to your INSTALLED_APPS setting like this:: | ||
|
||
INSTALLED_APPS = ( | ||
... | ||
'user_profile', | ||
) | ||
|
||
2. Include the user_profile URLconf in your project urls.py like this:: | ||
|
||
url(r'^profile/', include('user_profile.urls', namespace='profile')), | ||
|
||
3. Run `python manage.py syncdb` to create the user-profile models. | ||
|
||
4. Start the development server and visit http://127.0.0.1:8000, | ||
you need to create a superuser like this:: | ||
|
||
python manage.py createsuperuser | ||
|
||
5. Visit http://127.0.0.1:8000/admin to view the new app in Django Admin |
Empty file.
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,33 @@ | ||
#encoding:utf-8 | ||
import os | ||
from setuptools import setup | ||
|
||
README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() | ||
|
||
# allow setup.py to be run from any path | ||
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) | ||
|
||
setup( | ||
name='django-keoh-userprofile', | ||
version='0.0.1', | ||
packages=['user_profile'], | ||
include_package_data=True, | ||
license='BSD License', # example license | ||
description='A simple Django app with extended User model', | ||
long_description=README, | ||
url='http://mznstudio.herokuapp.com', | ||
author='Francisco Manzano Magaña', | ||
author_email='[email protected]', | ||
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: BSD License', # example license | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python', | ||
'Programming Language :: Python :: 2.6', | ||
'Programming Language :: Python :: 2.7', | ||
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
], | ||
) |
Empty file.
Empty file.
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,5 @@ | ||
from django.contrib import admin | ||
|
||
from .models import UserProfile | ||
|
||
admin.site.register(UserProfile) |
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 @@ | ||
#encoding:utf-8 | ||
from django import forms | ||
from django.contrib.auth.forms import UserCreationForm | ||
|
||
from .models import UserProfile | ||
|
||
class EmailUserCreationForm(UserCreationForm): | ||
|
||
username = forms.CharField(widget=forms.TextInput(attrs={'class': 'input', 'placeholder':'Username'})) | ||
email = forms.EmailField(widget=forms.EmailInput(attrs={'class': 'input', 'placeholder':'Email'})) | ||
password1 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'input', 'placeholder':'Escribe una contraseña'})) | ||
password2 = forms.CharField(widget=forms.PasswordInput(attrs={'class': 'input', 'placeholder':'Confirma contraseña'})) | ||
|
||
error_css_class = 'field-error' | ||
required_css_class = 'field-required' | ||
|
||
class Meta: | ||
model = UserProfile | ||
fields = ('username', 'email') |
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,9 @@ | ||
from django.contrib.auth.models import AbstractUser | ||
from django.db import models | ||
|
||
class UserProfile(AbstractUser): | ||
|
||
avatar = models.ImageField(upload_to='media/user_profile/', blank=True, default="media/user_profile/default.png") | ||
|
||
def __unicode__(self): | ||
return self.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends "base.html" %} | ||
{% load static from staticfiles %} | ||
|
||
{% block title %}Profile edition{% endblock %} | ||
|
||
{% block content %} | ||
{% include "header.html" with secction_name="Edit Profile"%} | ||
{% endblock %} |
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,8 @@ | ||
{% extends "base.html" %} | ||
{% load static from staticfiles %} | ||
|
||
{% block title %}Profile{% endblock %} | ||
|
||
{% block content %} | ||
{% include "header.html" with secction_name="Profile"%} | ||
{% endblock %} |
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,16 @@ | ||
<div class="login-form hidden" id="singin-form"> | ||
<p> | ||
Acceder | ||
</p> | ||
<form action=""> | ||
<div> | ||
<span class="icon-user"></span> | ||
<input type="text" placeholder="Username o email" class="input"> | ||
</div> | ||
<div> | ||
<span class="icon-lock"></span> | ||
<input type="password" placeholder="Elige contraseña" class="input"> | ||
</div> | ||
<input class="form-button" type="submit" value="Entrar"> | ||
</form> | ||
</div> |
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,25 @@ | ||
<div class="login-form hidden" id="singup-form"> | ||
<p> | ||
Crea una cuenta | ||
</p> | ||
<form action="" method='post'> | ||
{% csrf_token %} | ||
<div> | ||
<span class="icon-user"></span> | ||
{{ form_singup.username }} | ||
</div> | ||
<div> | ||
<span class="icon-mail"></span> | ||
{{ form_singup.email }} | ||
</div> | ||
<div> | ||
<span class="icon-lock"></span> | ||
{{ form_singup.password1 }} | ||
</div> | ||
<div> | ||
<span class="icon-lock"></span> | ||
{{ form_singup.password2 }} | ||
</div> | ||
<input class="form-button" type="submit" value="Registrarse"> | ||
</form> | ||
</div> |
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,25 @@ | ||
<div class="login-form"> | ||
<p> | ||
Crea una cuenta | ||
</p> | ||
<form action="" method='post'> | ||
{% csrf_token %} | ||
<div> | ||
<span class="icon-user"></span> | ||
<input type="text" placeholder="Username" class="input" name="username"> | ||
</div> | ||
<div> | ||
<span class="icon-mail"></span> | ||
<input type="email" placeholder="Email" class="input" name="email"> | ||
</div> | ||
<div> | ||
<span class="icon-lock"></span> | ||
<input type="password" placeholder="Elige un password" class="input" name="password1"> | ||
</div> | ||
<div> | ||
<span class="icon-lock"></span> | ||
<input type="password" placeholder="Confirma password" class="input" name="password2"> | ||
</div> | ||
<input class="form-button" type="submit" value="Registrarse"> | ||
</form> | ||
</div> |
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,10 @@ | ||
#encoding:utf-8 | ||
from django.conf.urls import patterns, url | ||
from .views import ProfilePageView, ProfileEditPageView | ||
|
||
urlpatterns = patterns('', | ||
url(r'^$', ProfilePageView.as_view(), name='home'), | ||
url(r'edit/$', ProfileEditPageView.as_view(), name='edit'), | ||
url(r'signin/$', ProfileEditPageView.as_view(), name='edit'), | ||
url(r'success/$', ProfileEditPageView.as_view(), name='success'), | ||
) |
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,12 @@ | ||
from django.views.generic.base import TemplateView, View | ||
from django.shortcuts import render | ||
|
||
from .forms import EmailUserCreationForm | ||
|
||
class ProfilePageView(TemplateView): | ||
template_name = 'profile.html' | ||
|
||
class ProfileEditPageView(TemplateView): | ||
template_name = 'profile-edit.html' | ||
|
||
|