diff --git a/.coverage b/.coverage index f4a01dc..57dca25 100644 --- a/.coverage +++ b/.coverage @@ -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]}} \ No newline at end of file +!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]}} \ No newline at end of file diff --git a/app/photos/api/image_edit.py b/app/photos/api/image_edit.py index 5bd9452..0baa64a 100644 --- a/app/photos/api/image_edit.py +++ b/app/photos/api/image_edit.py @@ -1,3 +1,7 @@ +import base64 +import cStringIO +import os + from django.http import HttpResponse from PIL import ( Image, ImageFilter, @@ -5,9 +9,6 @@ ImageEnhance, ImageDraw, ImageFont ) -import base64 -import cStringIO -import os class ImageEdit: diff --git a/app/photos/models.py b/app/photos/models.py index d4dd4d1..ab2a930 100644 --- a/app/photos/models.py +++ b/app/photos/models.py @@ -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'] diff --git a/app/photos/tests/test_api.py b/app/photos/tests/test_api.py index 9220af3..7891f4a 100644 --- a/app/photos/tests/test_api.py +++ b/app/photos/tests/test_api.py @@ -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): @@ -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) diff --git a/app/photos/tests/test_view.py b/app/photos/tests/test_view.py index cb81d8b..fd07f45 100644 --- a/app/photos/tests/test_view.py +++ b/app/photos/tests/test_view.py @@ -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) \ No newline at end of file diff --git a/app/photos/views.py b/app/photos/views.py index 50b8af4..e2b6a46 100644 --- a/app/photos/views.py +++ b/app/photos/views.py @@ -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 = { @@ -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) diff --git a/app/static/build/client.min.js b/app/static/build/client.min.js index 0d5c3d2..771a68d 100644 --- a/app/static/build/client.min.js +++ b/app/static/build/client.min.js @@ -46258,7 +46258,7 @@ _react2.default.createElement( "h3", null, - "Crop and Overlay" + "Text Overlay" ) ) ) diff --git a/app/static/components/BackgroundSlider.jsx b/app/static/components/BackgroundSlider.jsx index bea988a..aa5f27f 100644 --- a/app/static/components/BackgroundSlider.jsx +++ b/app/static/components/BackgroundSlider.jsx @@ -32,7 +32,7 @@ export default class extends React.Component {
  • Image 06
    -

    Crop and Overlay

    +

    Text Overlay

  • diff --git a/app/static/css/slide.css b/app/static/css/slide.css index 9bb24c3..bff64f4 100755 --- a/app/static/css/slide.css +++ b/app/static/css/slide.css @@ -71,7 +71,7 @@ text-align: right; - color: rgba(129, 255, 216, .8); + color: rgba(255, 255, 255, .8); text-shadow: 2px 2px #000; } diff --git a/app/static/images/slides/1.jpg b/app/static/images/slides/1.jpg old mode 100755 new mode 100644 index 3e82dee..2b64005 Binary files a/app/static/images/slides/1.jpg and b/app/static/images/slides/1.jpg differ diff --git a/app/static/images/slides/2.jpg b/app/static/images/slides/2.jpg old mode 100755 new mode 100644 index 83c5b7b..a43c067 Binary files a/app/static/images/slides/2.jpg and b/app/static/images/slides/2.jpg differ diff --git a/app/static/images/slides/3.jpg b/app/static/images/slides/3.jpg old mode 100755 new mode 100644 index 9837f38..6069cb8 Binary files a/app/static/images/slides/3.jpg and b/app/static/images/slides/3.jpg differ diff --git a/app/static/images/slides/4.jpg b/app/static/images/slides/4.jpg old mode 100755 new mode 100644 index f4c2715..1eafb54 Binary files a/app/static/images/slides/4.jpg and b/app/static/images/slides/4.jpg differ diff --git a/app/static/images/slides/5.jpg b/app/static/images/slides/5.jpg old mode 100755 new mode 100644 index 563d431..2b2aa20 Binary files a/app/static/images/slides/5.jpg and b/app/static/images/slides/5.jpg differ diff --git a/app/static/images/slides/6.jpg b/app/static/images/slides/6.jpg old mode 100755 new mode 100644 index 65d7ec3..4028957 Binary files a/app/static/images/slides/6.jpg and b/app/static/images/slides/6.jpg differ diff --git a/app/static/images/slides/ImagesByMarkSebastian.txt b/app/static/images/slides/ImagesByMarkSebastian.txt deleted file mode 100755 index 5ff1aa3..0000000 --- a/app/static/images/slides/ImagesByMarkSebastian.txt +++ /dev/null @@ -1,6 +0,0 @@ -Images by Mark Sebastian: http://www.flickr.com/photos/markjsebastian/ -http://www.markjsebastian.com/ - -License: -http://creativecommons.org/licenses/by-sa/2.0/deed.en -Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) \ No newline at end of file