-
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.
- Loading branch information
Showing
96 changed files
with
4,515 additions
and
16 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,6 @@ | ||
{ | ||
"directory": "bucketlist/static/lib", | ||
"analytics": false, | ||
"timeout": 120000, | ||
"interactive": false | ||
} |
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 @@ | ||
!coverage.py: This is a private format, don't read it directly!{"lines": {}} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
*.pyc | ||
.env.yml | ||
.env.py | ||
db.sqlite3 | ||
__pycache__ | ||
bucketlist/bucketlist/development.py | ||
bucketlist/static_cdn/* | ||
bucketlist/static_cdn/* | ||
.DS_Store |
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,11 @@ | ||
language: python | ||
python: | ||
- "2.7" | ||
# command to install dependencies | ||
install: | ||
- pip install -r requirements.txt | ||
script: | ||
- cd bucketlist | ||
- python manage.py test | ||
after_success: | ||
- coveralls |
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 |
---|---|---|
@@ -1 +1 @@ | ||
web: gunicorn bucketlist.wsgi --pythonpath=bucketlist --log-file=- | ||
web: python bucketlist/manage.py migrate; gunicorn bucketlist.wsgi --pythonpath=bucketlist --log-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 |
---|---|---|
@@ -1,2 +1,77 @@ | ||
# bucketlist-django | ||
According to Merriam-Webster Dictionary, a Bucket List is a list of things that one has not done before but wants to do before dying. | ||
# Django Powered Bucketlist Application | ||
|
||
[![Build Status](https://travis-ci.org/andela-snwuguru/bucketlist-django.svg?branch=master)](https://travis-ci.org/andela-snwuguru/bucketlist-django) [![Coverage Status](https://coveralls.io/repos/github/andela-snwuguru/bucketlist-django/badge.svg?branch=master)](https://coveralls.io/github/andela-snwuguru/bucketlist-django?branch=master) | ||
|
||
Nobody lives forever, it is what we do or archive that lives forever in the heart of men. This application gives you little hope to archive that. Pen it down, challenge yourself to do more. | ||
|
||
### Technology used | ||
|
||
- Django - Easy and faster way to build better web applications. | ||
- Djangorestframework - Django REST framework is a powerful and flexible toolkit for building Web APIs in Django powered apps. | ||
- AngularJS - AngularJS lets you extend HTML vocabulary for your application. | ||
- AngularJS Material - Angular Material is both a UI Component framework and a reference implementation of Google's Material Design Specification. | ||
- Django swagger - An API documentation generator for Swagger UI and Django REST Framework. | ||
|
||
### API Documentation | ||
|
||
The API documentation can be found <a href="https://littlehope.herokuapp.com/api/v1/docs">here</a> | ||
|
||
### How to use | ||
|
||
To install and run this application locally, you need to have python installed on your machine. | ||
|
||
#### Installation | ||
|
||
To install the build locally | ||
|
||
- `` $ git clone https://github.com/andela-snwuguru/bucketlist-django.git `` | ||
- `` $ cd bucketlist-django `` | ||
- `` $ pip install -r requirements.txt `` | ||
|
||
#### Set Up your environment key | ||
|
||
#### bucketlist-django/bucketlist/bucketlist/development.py | ||
|
||
Development.py file is required to get the database configuration. See content below | ||
``` | ||
import os, sys | ||
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3') if 'test' in sys.argv else os.path.join(BASE_DIR, 'db.sqlite3'), | ||
} | ||
} | ||
DEBUG = True | ||
``` | ||
|
||
#### bucketlist-django/.env.py | ||
.env.py file is also required to configure secured information. See content below. | ||
|
||
``` | ||
SECRET_KEY = "your-secret-code" | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'oauth2 key from google' | ||
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'oauth2 secret from google' | ||
SOCIAL_AUTH_FACEBOOK_KEY = 'app id' | ||
SOCIAL_AUTH_FACEBOOK_SECRET = 'app secret' | ||
SOCIAL_AUTH_TWITTER_KEY = 'customer key' | ||
SOCIAL_AUTH_TWITTER_SECRET = 'customer secret' | ||
``` | ||
|
||
|
||
#### Run your build | ||
|
||
`` $ python bucketlist/manage.py runserver `` | ||
|
||
#### Running the test | ||
|
||
`` $ cd bucketlist && python manage.py test `` | ||
|
||
### How to Contribute | ||
|
||
This is an open source project, feel free to fork the repo, add functionality to the project and raise a pull request. |
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 @@ | ||
{ | ||
"name": "bucketlist-django", | ||
"description": "Pen it down, push yourself to do more", | ||
"scripts": {}, | ||
"env": {}, | ||
"formation": { | ||
"web": { | ||
"quantity": 1 | ||
} | ||
}, | ||
"addons": [ | ||
"heroku-postgresql" | ||
], | ||
"buildpacks": [ | ||
{ | ||
"url": "heroku/python" | ||
} | ||
] | ||
} |
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,30 @@ | ||
{ | ||
"name": "Bucketlists", | ||
"version": "1.1.7", | ||
"authors": [ | ||
"Nwuguru Sunday <sunday.nwuguru@andela.com>" | ||
], | ||
"description": "Challenge yourself to do more", | ||
"main": "manage.py", | ||
"keywords": [ | ||
"angularjs", | ||
"Python", | ||
"Django" | ||
], | ||
"license": "GNU", | ||
"homepage": "http://littlehope.herokuapp.com/", | ||
"private": false, | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies": { | ||
"angular": "~1.5.3", | ||
"angular-sanitize": "~1.5.3", | ||
"angular-animate": "~1.5.3", | ||
"angular-material": "~1.1.0-rc2" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
import os, sys | ||
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | ||
import dj_database_url | ||
|
||
if 'test' in sys.argv: | ||
DATABASES = { | ||
'default': { | ||
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': os.path.join(BASE_DIR, 'testdb.sqlite3'), | ||
} | ||
} | ||
SECRET_KEY = "test-secret" | ||
|
||
|
||
else: | ||
DATABASES = { | ||
'default': dj_database_url.config() | ||
} | ||
DEBUG = False |
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
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,25 @@ | ||
from django.contrib import admin | ||
from .models import * | ||
|
||
|
||
class BucketListAdmin(admin.ModelAdmin): | ||
list_display = ['name', 'date_modified', 'date_created'] | ||
list_display_links = ['name'] | ||
list_filter = ['date_created'] | ||
search_fields = ['name'] | ||
|
||
class Meta: | ||
model = BucketList | ||
|
||
|
||
class BucketListItemAdmin(admin.ModelAdmin): | ||
list_display = ['task', 'bucketlist', 'date_modified', 'date_created'] | ||
list_display_links = ['task'] | ||
list_filter = ['date_created', 'bucketlist'] | ||
search_fields = ['task'] | ||
|
||
class Meta: | ||
model = BucketListItem | ||
|
||
admin.site.register(BucketList, BucketListAdmin) | ||
admin.site.register(BucketListItem, BucketListItemAdmin) |
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,19 @@ | ||
from django.shortcuts import get_object_or_404 | ||
|
||
from bucketlists.models import BucketList | ||
|
||
|
||
def get_bucketlist_by_api_view(obj): | ||
bucketlist_id = obj.kwargs.get('id',0) | ||
return get_object_or_404( | ||
BucketList, | ||
id=int(bucketlist_id), | ||
user=obj.request.user | ||
) | ||
|
||
|
||
def jwt_response_payload_handler(token, user=None, request=None): | ||
return { | ||
'token': token, | ||
'user': 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from rest_framework.pagination import PageNumberPagination | ||
|
||
|
||
class CustomPageNumberPagination(PageNumberPagination): | ||
page_size = 10 |
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,7 @@ | ||
from rest_framework.permissions import BasePermission | ||
|
||
|
||
class IsOwner(BasePermission): | ||
|
||
def has_object_permission(self, request, view, obj): | ||
return request.user == obj.user |
Oops, something went wrong.