Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
e98d92f
added site
pasaunders Jan 17, 2017
1bb7e55
user profile fields built
pasaunders Jan 17, 2017
bc7867f
pre-manager statusquo
pasaunders Jan 17, 2017
50cd84c
add make profile when user is made and tests
amosboldor Jan 17, 2017
3aa40d1
add is_active and ActiveProfileManager
amosboldor Jan 17, 2017
ccb4011
added __str__ method and default app config
pasaunders Jan 17, 2017
c01f3bc
remove and fix some tests
amosboldor Jan 17, 2017
44bdabf
add requirements.pip
amosboldor Jan 17, 2017
08a4a1b
add readme
amosboldor Jan 17, 2017
0cfedb8
change is_active
amosboldor Jan 17, 2017
ee2b05d
fixed some stuff
amosboldor Jan 17, 2017
27fd374
did makemigrations
amosboldor Jan 17, 2017
53d177a
built .travis.yml and requirements.pip
pasaunders Jan 17, 2017
e2b6883
Merge branch 'models-1' of https://github.com/pasaunders/django-image…
pasaunders Jan 17, 2017
061bb4c
added readme widget
pasaunders Jan 17, 2017
071b439
travis debugging
pasaunders Jan 18, 2017
d95f9ac
travis debugging
pasaunders Jan 18, 2017
2539092
travis debugging
pasaunders Jan 18, 2017
c1b08cd
travis debugging
pasaunders Jan 18, 2017
580c94c
travis debugging
pasaunders Jan 18, 2017
e4b3546
travis debugging
pasaunders Jan 18, 2017
f9a8523
travis debugging
pasaunders Jan 18, 2017
7f5d956
travis debugging
pasaunders Jan 18, 2017
00c1b3f
add admin, some teplates and other stuff
amosboldor Jan 18, 2017
1949491
fix home template
amosboldor Jan 18, 2017
d3d1e57
change url
amosboldor Jan 18, 2017
94b6e32
some bootstrap code, one more test, requirements.pip updated
pasaunders Jan 18, 2017
e4121cb
first pass HMAC templates
pasaunders Jan 19, 2017
f05f366
first pass HMAC templates
pasaunders Jan 19, 2017
156f329
login logout and register seem to work
pasaunders Jan 19, 2017
4496d49
readme change
pasaunders Jan 19, 2017
692f00c
begin second app models
pasaunders Jan 19, 2017
c4fd524
add MEDIA folder and the gitkeep for it and gitignore lines
amosboldor Jan 19, 2017
60c823b
add fix for only add profile if created True
amosboldor Jan 19, 2017
34e6338
add MEDIA_ROOT
amosboldor Jan 19, 2017
5544449
add ability for admin to create model for images
amosboldor Jan 19, 2017
533e6e9
add photo and album models and migration
amosboldor Jan 19, 2017
399d538
update requirements.pip with Pillow==4.0.0
amosboldor Jan 19, 2017
caf4ff7
new tests
pasaunders Jan 20, 2017
b70a7b6
extend tests, needs debugging
pasaunders Jan 20, 2017
f7066ee
new templates, new login page.
pasaunders Jan 21, 2017
94ae0ec
login redirect to profile page, if user not logged in /profile/ redir…
amosboldor Jan 22, 2017
a2ee661
add more to profile template
amosboldor Jan 22, 2017
9d764c2
add so that /profile/ is current logged in user and /profile/<usernam…
amosboldor Jan 22, 2017
2b026a5
remove not needed any more public key dict
amosboldor Jan 22, 2017
ed38dd5
moved profile to urls and view to their correct place
amosboldor Jan 22, 2017
b1d348e
add photo and photos routes
amosboldor Jan 23, 2017
9024b29
add some bootstrap
amosboldor Jan 23, 2017
1aefdf1
album routes and views, tested manually. tests sketched out but none …
pasaunders Jan 24, 2017
1e76e7a
made library view and url
amosboldor Jan 24, 2017
4c93029
fix albums template
amosboldor Jan 24, 2017
f9f3a6f
update requirements.pip
amosboldor Jan 24, 2017
7d872be
all existing tests pass
pasaunders Jan 25, 2017
b66727b
working profile tests, first steps toward images tests.
pasaunders Jan 25, 2017
c7e4cd3
add photos stuff to library template
amosboldor Jan 25, 2017
6965f54
add title and description to photos template
amosboldor Jan 25, 2017
124c84e
add div container to base and stuff to login template
amosboldor Jan 25, 2017
749035a
add |title for templane user.first_name
amosboldor Jan 25, 2017
b8e53ae
move album and image model tests to frontend-2
amosboldor Jan 30, 2017
bf77567
move changes from models-2 to frontend-2
amosboldor Jan 30, 2017
7a50c5e
move profile model changes to front-end-2
amosboldor Jan 30, 2017
8c1e522
move small model changes to this branch
amosboldor Jan 30, 2017
87b2b10
change test datebase environment variable name to TEST_IMAGER_DATABASE
amosboldor Jan 30, 2017
3ec34ee
make small change to test
amosboldor Jan 30, 2017
591c62e
add test image
amosboldor Jan 30, 2017
18389db
add migrations files from changed models
amosboldor Jan 30, 2017
acd1524
add title of album in library
amosboldor Jan 30, 2017
06cc1cf
add frontend tests
amosboldor Jan 30, 2017
6d9f801
remove commented code
amosboldor Jan 30, 2017
4cf814a
add description to single album view and add test for it
amosboldor Jan 30, 2017
b81b2fb
change route name
amosboldor Jan 30, 2017
e8b4467
add description to single photo template and added test for it
amosboldor Jan 30, 2017
fd99fe2
test for photo decription
amosboldor Jan 30, 2017
50e2cc2
test for photo title in single photo
amosboldor Jan 30, 2017
7a05346
add email setting and small fixes
amosboldor Jan 31, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ bin/
lib64
pyvenv.cfg
share/
pip-selfcheck.json

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -91,3 +92,7 @@ ENV/

# Rope project settings
.ropeproject

# Ignore the files in the Media directory, but not the directory itself
imagersite/MEDIA/*
!imagersite/MEDIA/.gitkeep
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: python
python:
- "2.7"
- "3.5"

# command to install dependencies
install:
# - pip install .
- pip install -r requirements.pip

services:
- postgresql

before_script:
- psql -c 'create database travis_ci_test;' -U postgres

# command to run tests
script: python imagersite/manage.py test
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,41 @@
# django-imager
django introduction assignment
[![Build Status](https://travis-ci.org/pasaunders/django-imager.svg?branch=front-end-1)](https://travis-ci.org/pasaunders/django-imager)
## Getting Started

Clone this repository into whatever directory you want to work from.

```bash
$ git clone https://github.com/pasaunders/django-imager.git
```

Assuming that you have access to Python 3 at the system level, start up a new virtual environment.

```bash
$ cd django-imager
$ python3 -m venv .
$ source bin/activate
```

Once your environment has been activated, make sure to install Django and all of this project's required packages.

```bash
(django-imager) $ pip install -r requirements.pip
```

Navigate to the project root, `imagersite`, and apply the migrations for the app.

```bash
(django-imager) $ cd lending_library
(django-imager) $ ./manage.py migrate
```

Finally, run the server in order to server the app on `localhost`

```bash
(django-imager) $ ./manage.py runserver
```

Django will typically serve on port 8000, unless you specify otherwise.
You can access the locally-served site at the address `http://localhost:8000`.

Resources we used:
http://stackoverflow.com/questions/10180764/django-auth-login-problems
Empty file added imagersite/MEDIA/.gitkeep
Empty file.
Empty file.
5 changes: 5 additions & 0 deletions imagersite/imager_images/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.contrib import admin
from imager_images.models import Album, Photo

admin.site.register(Album)
admin.site.register(Photo)
5 changes: 5 additions & 0 deletions imagersite/imager_images/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from django.apps import AppConfig


class ImagerImagesConfig(AppConfig):
name = 'imager_images'
61 changes: 61 additions & 0 deletions imagersite/imager_images/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-19 05:16
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import imager_images.models


class Migration(migrations.Migration):

initial = True

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='Album',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=60)),
('description', models.TextField(max_length=200)),
('date_created', models.DateTimeField(auto_now_add=True)),
('date_modified', models.DateTimeField(auto_now=True)),
('date_published', models.DateTimeField(null=True)),
('published', models.CharField(choices=[('private', 'private'), ('shared', 'shared'), ('public', 'public')], max_length=10)),
],
),
migrations.CreateModel(
name='Photo',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('image', models.ImageField(upload_to=imager_images.models.image_path)),
('title', models.CharField(max_length=60)),
('description', models.TextField(max_length=120)),
('date_uploaded', models.DateTimeField(auto_now_add=True)),
('date_modified', models.DateTimeField(auto_now=True)),
('date_published', models.DateTimeField(null=True)),
('published', models.CharField(choices=[('private', 'private'), ('shared', 'shared'), ('public', 'public')], max_length=10)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='photos', to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='album',
name='cover',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='albums_covered', to='imager_images.Photo'),
),
migrations.AddField(
model_name='album',
name='photos',
field=models.ManyToManyField(related_name='albums', to='imager_images.Photo'),
),
migrations.AddField(
model_name='album',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='albums', to=settings.AUTH_USER_MODEL),
),
]
56 changes: 56 additions & 0 deletions imagersite/imager_images/migrations/0002_auto_20170129_1804.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-30 02:04
from __future__ import unicode_literals

from django.db import migrations, models
import imager_images.models


class Migration(migrations.Migration):

dependencies = [
('imager_images', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='album',
name='date_published',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='album',
name='published',
field=models.CharField(choices=[('private', 'private'), ('shared', 'shared'), ('public', 'public')], default='public', max_length=10),
),
migrations.AlterField(
model_name='photo',
name='date_modified',
field=models.DateTimeField(auto_now=True, null=True),
),
migrations.AlterField(
model_name='photo',
name='date_published',
field=models.DateTimeField(blank=True, null=True),
),
migrations.AlterField(
model_name='photo',
name='date_uploaded',
field=models.DateTimeField(auto_now_add=True, null=True),
),
migrations.AlterField(
model_name='photo',
name='description',
field=models.TextField(blank=True, max_length=120, null=True),
),
migrations.AlterField(
model_name='photo',
name='image',
field=models.ImageField(blank=True, null=True, upload_to=imager_images.models.image_path),
),
migrations.AlterField(
model_name='photo',
name='published',
field=models.CharField(choices=[('private', 'private'), ('shared', 'shared'), ('public', 'public')], default='public', max_length=10),
),
]
Empty file.
68 changes: 68 additions & 0 deletions imagersite/imager_images/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.contrib.auth.models import User

PUBLISHED_OPTIONS = (
("private", "private"),
("shared", "shared"),
("public", "public"),
)


def image_path(instance, file_name):
"""Upload file to media root in user folder."""
return 'user_{0}/{1}'.format(instance.user.id, file_name)


@python_2_unicode_compatible
class Photo(models.Model):
"""Create Photo Model."""

user = models.ForeignKey(
User,
related_name='photos',
on_delete=models.CASCADE,
)
image = models.ImageField(upload_to=image_path, blank=True, null=True)
title = models.CharField(max_length=60)
description = models.TextField(max_length=120, blank=True, null=True)
date_uploaded = models.DateTimeField(auto_now_add=True, blank=True, null=True)
date_modified = models.DateTimeField(auto_now=True, blank=True, null=True)
date_published = models.DateTimeField(null=True, blank=True)
published = models.CharField(max_length=10, choices=PUBLISHED_OPTIONS, default='public')

def __str__(self):
"""Return string description of album."""
return "{}: Photo belonging to {}".format(self.title, self.user)


@python_2_unicode_compatible
class Album(models.Model):
"""Create Album Model."""

user = models.ForeignKey(
User,
related_name="albums",
on_delete=models.CASCADE,
)
cover = models.ForeignKey(
"Photo",
null=True,
related_name="albums_covered"
)
title = models.CharField(max_length=60)
description = models.TextField(max_length=200)
photos = models.ManyToManyField(
"Photo",
related_name="albums",
symmetrical=False
)
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(auto_now=True)
date_published = models.DateTimeField(null=True, blank=True)
published = models.CharField(max_length=10, choices=PUBLISHED_OPTIONS, default="public")

def __str__(self):
"""Return String Representation of Album."""
return "{}: Album belonging to {}".format(self.title, self.user)
17 changes: 17 additions & 0 deletions imagersite/imager_images/templates/imager_images/album.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'imagersite/base.html' %}
{% block content %}
<h1>Your Album:</h1>
<div class="galleria" style="height:500px; width: 800px;">
<img src="{{ album.cover.image.url }}">
{% for photo in album.photos.all %}
<img src="{{ photo.image.url }}">
{% endfor %}
</div>
{{ album.description }}
<script>
(function() {
Galleria.loadTheme('https://cdnjs.cloudflare.com/ajax/libs/galleria/1.4.5/themes/classic/galleria.classic.min.js');
Galleria.run('.galleria');
}());
</script>
{% endblock content %}
15 changes: 15 additions & 0 deletions imagersite/imager_images/templates/imager_images/albums.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'imagersite/base.html' %}
{% load thumbnail %}
{% block content %}
<h1>Public Albums</h1>
<div>
{% for album in albums %}
<h1>{{ album.title }}</h1>
<a href="{% url 'single_album' album.id %}">
{% thumbnail album.cover.image "200x200" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
</a>
{% endfor %}
</div>
{% endblock content %}
29 changes: 29 additions & 0 deletions imagersite/imager_images/templates/imager_images/library.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends 'imagersite/base.html' %}
{% load thumbnail %}
{% block content %}
<section>
{% if user.first_name %}
<h2>{{user.first_name|title }}'s Library</h2>
{% else %}
<h2>{{user.username }}'s Library</h2>
{% endif %}
<h3>Albums:</h3>
{% for album in albums %}
<a href="albums/{{ album.id }}" title="">
<h3>{{ album.title }}</h3>
{% thumbnail album.cover.image "200x200" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
</a>
{% endfor %}
<h3>Images</h3>
{% for photo in photos %}
<a href="{% url 'public_profile' photo.id %}">
<h3>{{ photo.title }}</h3>
{% thumbnail photo.image "200x200" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
</a>
{% endfor %}
</section>
{% endblock content %}
7 changes: 7 additions & 0 deletions imagersite/imager_images/templates/imager_images/photo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% extends 'imagersite/base.html' %}
{% block content %}
<h1>Photo</h1>
<h3>{{ photo.title }}</h3>
<img src="{{ photo.image.url }}">
<p>{{ photo.description }}</p>
{% endblock content %}
15 changes: 15 additions & 0 deletions imagersite/imager_images/templates/imager_images/photos.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% extends 'imagersite/base.html' %}
{% block content %}
<h1>Photos</h1>
<div class="galleria" style="height:500px; width: 800px;">
{% for photo in photos %}
<img src="{{ photo.image.url }}" data-title="{{ photo.title }}" data-description="{{ photo.description }}" />
{% endfor %}
</div>
<script>
(function() {
Galleria.loadTheme('https://cdnjs.cloudflare.com/ajax/libs/galleria/1.4.5/themes/classic/galleria.classic.min.js');
Galleria.run('.galleria');
}());
</script>
{% endblock content %}
Binary file added imagersite/imager_images/test_img.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading