Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
KeoH committed May 2, 2014
0 parents commit 6314c66
Show file tree
Hide file tree
Showing 18 changed files with 235 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/
dist/
django_keoh_userprofile.egg-info/
*.pyc
24 changes: 24 additions & 0 deletions LICENSE
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.
6 changes: 6 additions & 0 deletions MANIFEST.in
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
31 changes: 31 additions & 0 deletions README.rst
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 added docs/empty
Empty file.
33 changes: 33 additions & 0 deletions setup.py
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 added static/empty
Empty file.
Empty file added user_profile/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions user_profile/admin.py
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)
19 changes: 19 additions & 0 deletions user_profile/forms.py
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')
9 changes: 9 additions & 0 deletions user_profile/models.py
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
8 changes: 8 additions & 0 deletions user_profile/templates/profile-edit.html
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 %}
8 changes: 8 additions & 0 deletions user_profile/templates/profile.html
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 %}
16 changes: 16 additions & 0 deletions user_profile/templates/signin.html
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>
25 changes: 25 additions & 0 deletions user_profile/templates/signup.html
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>
25 changes: 25 additions & 0 deletions user_profile/templates/signup2.html
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>
10 changes: 10 additions & 0 deletions user_profile/urls.py
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'),
)
12 changes: 12 additions & 0 deletions user_profile/views.py
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'


0 comments on commit 6314c66

Please sign in to comment.