Skip to content

Commit

Permalink
[Chore] Code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Nwuguru Sunday committed Jul 20, 2016
1 parent e2377ea commit 619d7bf
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .coverage
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/__init__.py": [1], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/views.py": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 21, 22, 24, 27, 60], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/urls.py": [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_edit.py": [1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, 130, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_processor.py": [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/permissions.py": [1, 4, 6, 7], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/serializers.py": [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 102, 103, 104, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/views.py": [1, 2, 3, 4, 5, 6, 7, 11, 12, 15, 16, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 99, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 118, 128, 130, 131, 134, 135, 136, 137, 138, 139, 140, 141, 143, 144, 148, 149, 150, 151, 152, 153, 154, 156, 157, 159, 160, 161, 162, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 191, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 245, 246, 247, 248]}}
!coverage.py: This is a private format, don't read it directly!{"lines": {"/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/__init__.py": [1], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/views.py": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 24, 27, 60], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/urls.py": [1, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_edit.py": [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/image_processor.py": [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/permissions.py": [1, 4, 6, 7], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/serializers.py": [1, 2, 3, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 59, 60, 61, 62, 64, 65, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 98, 99, 102, 103, 104, 105, 106, 108, 109, 111, 112, 114, 115, 116, 118, 119], "/Users/andela/Documents/projects/django-app/photo-editing/app/photos/api/views.py": [1, 2, 3, 4, 5, 6, 7, 11, 12, 15, 16, 19, 20, 21, 22, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 88, 99, 101, 102, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 118, 128, 130, 131, 134, 135, 136, 137, 138, 139, 140, 141, 143, 144, 148, 149, 150, 151, 152, 153, 154, 156, 157, 159, 160, 161, 162, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 191, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 215, 216, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 229, 230, 231, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 245, 246, 247, 248]}}
7 changes: 4 additions & 3 deletions app/photos/api/image_edit.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import base64
import cStringIO
import os

from django.http import HttpResponse
from PIL import (
Image, ImageFilter,
ImageOps, ImageStat,
ImageEnhance, ImageDraw,
ImageFont
)
import base64
import cStringIO
import os


class ImageEdit:
Expand Down
11 changes: 0 additions & 11 deletions app/photos/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,3 @@ class Photo(models.Model):

class Meta:
ordering = ['-date_created']


class PhotoDetail(models.Model):
photo = models.ForeignKey(Photo, default=0)
title = models.CharField(max_length=100, default="")
effects = models.TextField(default='')
date_modified = models.DateTimeField(auto_now=True, auto_now_add=False)
date_created = models.DateTimeField(auto_now=False, auto_now_add=True)

class Meta:
ordering = ['-date_created']
9 changes: 8 additions & 1 deletion app/photos/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json, os
from django.contrib.auth.models import User
from django.core.files.uploadedfile import SimpleUploadedFile
from rest_framework.test import APITestCase
import json, os


def register(client):
Expand Down Expand Up @@ -139,6 +139,13 @@ def test_photo_update(self):
self.assertEqual(result.get('id'), photo_id)
self.assertEqual(result.get('title'), 'test image')

def test_photo_download(self):
response = create_photo(self.client)
result = decode_json(response)
photo_id = result.get('id', 0)
response = self.client.get('/download?image=' + str(photo_id))
self.assertEqual(response.status_code, 301)

def test_photo_delete(self):
response = create_photo(self.client)
result = decode_json(response)
Expand Down
2 changes: 1 addition & 1 deletion app/photos/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ def test_home(self):
def test_login(self):
self.client.login(username='sundayguru', password='tester')
response = self.client.get('/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.status_code, 200)
7 changes: 1 addition & 6 deletions app/photos/views.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
from django.contrib.auth import logout
from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import redirect
import urllib

from photos.models import Photo
from photos.api.image_edit import *

# Create your views here.


def index(request):
context = {
Expand All @@ -17,12 +14,10 @@ def index(request):
}
return render(request, 'base.html', context)


def logout_view(request):
logout(request)
return redirect('/')


def download(request):
id = request.GET.get('image')
photo = Photo.objects.get(id=id)
Expand Down
2 changes: 1 addition & 1 deletion app/static/build/client.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -46258,7 +46258,7 @@
_react2.default.createElement(
"h3",
null,
"Crop and Overlay"
"Text Overlay"
)
)
)
Expand Down
2 changes: 1 addition & 1 deletion app/static/components/BackgroundSlider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class extends React.Component {
</li>
<li><span>Image 06</span>
<div>
<h3>Crop and Overlay</h3>
<h3>Text Overlay</h3>
</div>
</li>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion app/static/css/slide.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

text-align: right;

color: rgba(129, 255, 216, .8);
color: rgba(255, 255, 255, .8);
text-shadow: 2px 2px #000;
}

Expand Down
Binary file modified app/static/images/slides/1.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/static/images/slides/2.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/static/images/slides/3.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/static/images/slides/4.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/static/images/slides/5.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/static/images/slides/6.jpg
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions app/static/images/slides/ImagesByMarkSebastian.txt

This file was deleted.

0 comments on commit 619d7bf

Please sign in to comment.