Merge pull request #228 from pydanny/django-1.8

Django 1.8 Support
This commit is contained in:
Daniel Greenfeld 2015-04-26 08:45:21 -07:00
commit 8bfe28a721
13 changed files with 35 additions and 125 deletions

View File

@ -21,13 +21,12 @@ This cookiecutter template uses features that exists only in cookiecutter 0.9.0
Features
---------
* For Django 1.7
* For Django 1.8
* Twitter Bootstrap_ 3
* AngularJS_
* 12-Factor_ based settings via django-environ_
* Optimized development and production settings
* Registration via django-allauth_
* User avatars via django-avatar_
* Procfile_ for deploying to Heroku
* Grunt build for compass and livereload
* Basic e-mail configurations for send emails via SendGrid_
@ -47,7 +46,7 @@ Constraints
-----------
* Only maintained 3rd party libraries are used.
* PostgreSQL everywhere
* PostgreSQL everywhere (9.0+)
* Environment variables for configuration (This won't work with Apache/mod_wsgi).

View File

@ -36,7 +36,6 @@ DJANGO_APPS = (
)
THIRD_PARTY_APPS = (
'crispy_forms', # Form layouts
'avatar', # for user avatars
'allauth', # registration
'allauth.account', # registration
'allauth.socialaccount', # registration

View File

@ -21,9 +21,6 @@ urlpatterns = patterns('', # noqa
url(r'^users/', include("{{ cookiecutter.repo_name }}.users.urls", namespace="users")),
url(r'^accounts/', include('allauth.urls')),
# Uncomment the next line to enable avatars
url(r'^avatar/', include('avatar.urls')),
# Your stuff: custom urls includes go here

View File

@ -1,5 +1,5 @@
# Bleeding edge Django
django>=1.7.7,<1.8
django==1.8
# Configuration
django-environ==0.3.0
@ -27,9 +27,6 @@ psycopg2==2.6
unicode-slugify==0.1.3
django-autoslug==1.7.2
# Useful things
django-avatar==2.0
# Time zones support
pytz==2015.2

View File

@ -14,16 +14,18 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Site',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('domain', models.CharField(max_length=100, verbose_name='domain name', validators=[django.contrib.sites.models._simple_domain_name_validator])),
('name', models.CharField(max_length=50, verbose_name='display name')),
('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
('domain', models.CharField(verbose_name='domain name', max_length=100, validators=[django.contrib.sites.models._simple_domain_name_validator])),
('name', models.CharField(verbose_name='display name', max_length=50)),
],
options={
'ordering': ('domain',),
'db_table': 'django_site',
'verbose_name': 'site',
'verbose_name_plural': 'sites',
'verbose_name': 'site',
'db_table': 'django_site',
'ordering': ('domain',),
},
bases=(models.Model,),
managers=[
(b'objects', django.contrib.sites.models.SiteManager()),
],
),
]

View File

@ -1,23 +0,0 @@
{% raw %}
{% extends "avatar/base.html" %}
{% load i18n avatar_tags %}
{% load url from future %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>{% trans "Your current avatar: " %}</h2>
{% avatar user %}
{% if not avatars %}
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% endif %}
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar_add' %}">
{{ upload_avatar_form.as_p }}
<p>{% csrf_token %}<input type="submit" value="{% trans "Upload New Image" %}" /></p>
</form>
</div>
</div>
</div>
{% endblock %}
{% endraw %}

View File

@ -1 +0,0 @@
{% raw %}<img src="{{ url }}" width="{{ size }}" height="{{ size }}" class="img-thumbnail">{% endraw %}

View File

@ -1,5 +0,0 @@
{% raw %}{% extends "base.html" %}
{% block title %}django-avatar{% endblock %}
{% block content %}{% endblock %}
{% endraw %}

View File

@ -1,29 +0,0 @@
{% raw %}{% extends "avatar/base.html" %}
{% load i18n avatar_tags %}
{% load url from future %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>{% trans "Your current avatar: " %}</h2>
{% avatar user %}
{% if not avatars %}
<p>{% trans "You haven't uploaded an avatar yet. Please upload one now." %}</p>
{% else %}
<form method="POST" action="{% url 'avatar_change' %}">
<ul>
{{ primary_avatar_form.as_ul }}
</ul>
<p>{% csrf_token %}<input type="submit" value="{% trans "Choose new Default" %}" /></p>
</form>
{% endif %}
<form enctype="multipart/form-data" method="POST" action="{% url 'avatar_add' %}">
{{ upload_avatar_form.as_p }}
<p>{% csrf_token %}<input type="submit" value="{% trans "Upload New Image" %}" /></p>
</form>
</div>
</div>
</div>
{% endblock %}
{% endraw %}

View File

@ -1,25 +0,0 @@
{% raw %}{% extends "avatar/base.html" %}
{% load i18n %}
{% load url from future %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-xs-12">
<h2>{% trans "Please select the avatars that you would like to delete." %}</h2>
{% if not avatars %}
{% url 'avatar_change' as avatar_change_url %}
<p>{% blocktrans %}You have no avatars to delete. Please <a href="{{ avatar_change_url }}">upload one</a> now.{% endblocktrans %}</p>
{% else %}
<form method="POST" action="{% url 'avatar_delete' %}">
<ul>
{{ delete_avatar_form.as_ul }}
</ul>
<p>{% csrf_token %}<input type="submit" value="{% trans "Delete These" %}" /></p>
</form>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% endraw %}

View File

@ -1,5 +1,4 @@
{% raw %}{% extends "base.html" %}
{% load avatar_tags %}
{% load static %}
{% block title %}User: {{ object.username }}{% endblock %}
@ -21,7 +20,6 @@
<div class="col-sm-12 ">
<a class="btn btn-primary" href="{% url 'users:update' %}">My Info</a>
<a class="btn btn-primary" href="{% url 'account_email' %}">E-Mail</a>
<a class="btn btn-info" href="{% url 'avatar_change' %}">Avatar</a>
<!-- Your Stuff: Custom user template urls -->
</div>

View File

@ -1,7 +1,5 @@
{% raw %}{% extends "base.html" %}
{% load static %}{% load i18n %}
{% load avatar_tags %}
{% block title %}Members{% endblock %}
{% block content %}
@ -19,7 +17,7 @@
<div class="list-group">
{% for user in user_list %}
<a href="{% url 'users:detail' user.username %}" class="list-group-item">
<h4 class="list-group-item-heading">{% avatar user %} {{ user.username }}</h4>
<h4 class="list-group-item-heading">{{ user.username }}</h4>
<p class="list-group-item-text">{{ maker.tagline }}</p>
</a>
{% endfor %}

View File

@ -3,38 +3,41 @@ from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.contrib.auth.models
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
('auth', '0006_require_contenttypes_0002'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('id', models.AutoField(primary_key=True, verbose_name='ID', serialize=False, auto_created=True)),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('username', models.CharField(help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')])),
('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)),
('is_superuser', models.BooleanField(help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status', default=False)),
('username', models.CharField(max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], verbose_name='username', error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True)),
('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
('email', models.EmailField(max_length=75, verbose_name='email address', blank=True)),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('groups', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups')),
('user_permissions', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')),
('email', models.EmailField(max_length=254, verbose_name='email address', blank=True)),
('is_staff', models.BooleanField(help_text='Designates whether the user can log into this admin site.', verbose_name='staff status', default=False)),
('is_active', models.BooleanField(help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active', default=True)),
('date_joined', models.DateTimeField(verbose_name='date joined', default=django.utils.timezone.now)),
('groups', models.ManyToManyField(related_name='user_set', blank=True, verbose_name='groups', to='auth.Group', help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_query_name='user')),
('user_permissions', models.ManyToManyField(related_name='user_set', blank=True, verbose_name='user permissions', to='auth.Permission', help_text='Specific permissions for this user.', related_query_name='user')),
],
options={
'abstract': False,
'verbose_name': 'user',
'abstract': False,
'verbose_name_plural': 'users',
},
bases=(models.Model,),
)
managers=[
(b'objects', django.contrib.auth.models.UserManager()),
],
),
]