Skip to content

Commit 6d4b31a

Browse files
committed
Complete Working App from boilerplate
0 parents  commit 6d4b31a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2067
-0
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "static/bower_components"
3+
}

.buildpacks

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://github.com/heroku/heroku-buildpack-python.git
2+
https://github.com/heroku/heroku-buildpack-nodejs.git

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Python compiled byte code
2+
*.pyc
3+
4+
# SQLite3 database
5+
*.sqlite3
6+
7+
# Node modules
8+
node_modules/
9+
10+
# Bower components
11+
static/bower_components/
12+
13+
# Uglified JavaScript
14+
dist/
15+
16+
# Staticfiles
17+
staticfiles/
18+
19+
# PyCharm
20+
.idea
21+
22+
# npm
23+
npm-debug.log
24+

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn django_and_angular.wsgi --log-file -

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# thinkster-django-angular-boilerplate
2+
3+
## Installation
4+
5+
*NOTE: Requires [virtualenv](http://virtualenv.readthedocs.org/en/latest/),
6+
[virtualenvwrapper](http://virtualenvwrapper.readthedocs.org/en/latest/) and
7+
[Node.js](http://nodejs.org/).*
8+
9+
* Fork this repository.
10+
* `$ git clone [email protected]:<your username>/thinkster-django-angular-boilerplate.git`
11+
* `$ mkvirtualenv thinkster-djangular`
12+
* `$ cd thinkster-django-angular-boilerplate/`
13+
* `$ pip install -r requirements.txt`
14+
* `$ npm install -g bower`
15+
* `$ npm install`
16+
* `$ bower install`
17+
* `$ python manage.py migrate`
18+
* `$ python manage.py runserver`
19+

authentication/__init__.py

Whitespace-only changes.

authentication/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
import django.utils.timezone
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Account',
16+
fields=[
17+
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
18+
('password', models.CharField(max_length=128, verbose_name='password')),
19+
('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')),
20+
('email', models.EmailField(unique=True, max_length=75)),
21+
('username', models.CharField(unique=True, max_length=40)),
22+
('first_name', models.CharField(max_length=40, blank=True)),
23+
('last_name', models.CharField(max_length=40, blank=True)),
24+
('tagline', models.CharField(max_length=140, blank=True)),
25+
('is_admin', models.BooleanField(default=False)),
26+
('created_at', models.DateTimeField(auto_now_add=True)),
27+
('updated_at', models.DateTimeField(auto_now=True)),
28+
],
29+
options={
30+
'abstract': False,
31+
},
32+
bases=(models.Model,),
33+
),
34+
]

authentication/migrations/__init__.py

Whitespace-only changes.

authentication/models.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
2+
from django.db import models
3+
4+
5+
class AccountManager(BaseUserManager):
6+
def create_user(self, email, password=None, **kwargs):
7+
if not email:
8+
raise ValueError('Users must have a valid email address.')
9+
10+
if not kwargs.get('username'):
11+
raise ValueError('Users must have a valid username.')
12+
13+
account = self.model(
14+
email=self.normalize_email(email), username=kwargs.get('username')
15+
)
16+
17+
account.set_password(password)
18+
account.save()
19+
20+
return account
21+
22+
def create_superuser(self, email, password, **kwargs):
23+
account = self.create_user(email, password, **kwargs)
24+
25+
account.is_admin = True
26+
account.save()
27+
28+
return account
29+
30+
31+
class Account(AbstractBaseUser):
32+
email = models.EmailField(unique=True)
33+
username = models.CharField(max_length=40, unique=True)
34+
35+
first_name = models.CharField(max_length=40, blank=True)
36+
last_name = models.CharField(max_length=40, blank=True)
37+
tagline = models.CharField(max_length=140, blank=True)
38+
39+
is_admin = models.BooleanField(default=False)
40+
41+
created_at = models.DateTimeField(auto_now_add=True)
42+
updated_at = models.DateTimeField(auto_now=True)
43+
44+
objects = AccountManager()
45+
46+
USERNAME_FIELD = 'email'
47+
REQUIRED_FIELDS = ['username']
48+
49+
def __unicode__(self):
50+
return self.email
51+
52+
def get_full_name(self):
53+
return ' '.join([self.first_name, self.last_name])
54+
55+
def get_short_name(self):
56+
return self.first_name

0 commit comments

Comments
 (0)