Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
02cc98f
first commit
pasaunders Jan 17, 2017
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
c3cdc95
turned home into class based view
amosboldor Jan 26, 2017
ab3cbcf
turn profile views into class based views
amosboldor Jan 26, 2017
0d42a98
made photo and photos views class based
amosboldor Jan 26, 2017
734ad4e
turn album and albums into classbased view
amosboldor Jan 26, 2017
1453094
made library view class based
amosboldor Jan 26, 2017
af46fd6
debuged library, added photo templates and album routes
pasaunders Jan 27, 2017
70a6ced
got add album to work
amosboldor Jan 27, 2017
4a5297c
made add photo view work
amosboldor Jan 27, 2017
2cefbcc
replace redirect url function with reverse lazy
amosboldor Jan 27, 2017
a5f1a88
add edit and edit photos
amosboldor Jan 27, 2017
a0a2f47
updating latest version with tests. really odd testing error.
pasaunders Jan 31, 2017
89fcd75
template update
pasaunders Jan 31, 2017
600bc80
debugged tests except for the dictionary update sequence element prob…
pasaunders Jan 31, 2017
0e1c669
added email backend in settings
pasaunders Jan 31, 2017
cd6027f
100% of tests working
pasaunders Jan 31, 2017
cb43ada
add
amosboldor Jan 31, 2017
d3bf1db
Merge pull request #7 from amosboldor/front-end-4
amosboldor Jan 31, 2017
f7ab1a6
Revert "add"
amosboldor Jan 31, 2017
c3cac1b
Merge pull request #9 from pasaunders/revert-7-front-end-4
amosboldor Jan 31, 2017
0e25053
first pass security, manually tested
pasaunders Feb 1, 2017
02d4dd7
Merge branch 'front-end-4' of https://github.com/pasaunders/django-im…
pasaunders Feb 1, 2017
d852374
format and fix library template
amosboldor Feb 1, 2017
d959769
installed taggit and added it to requirements.pip and setting.py
amosboldor Feb 1, 2017
8a72fc4
add tag manager to photo model add view, template and url to render a…
amosboldor Feb 1, 2017
8437102
add tags to library template
amosboldor Feb 1, 2017
e7cb4c1
add tags to photo.html template
amosboldor Feb 1, 2017
20b2c0a
add tags to every photo in album
amosboldor Feb 1, 2017
845fb58
namespacing issue in reverse_lazy resolved
pasaunders Feb 2, 2017
450fa74
add user to group on register
amosboldor Feb 2, 2017
a4a896a
navigation buttons
pasaunders Feb 3, 2017
99636ae
album update buttons
pasaunders Feb 3, 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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ var/
*.egg-info/
.installed.cfg
*.egg
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 @@ -87,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
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,44 @@
# 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

library template requires:
pip install -e git+https://github.com/mariocesar/sorl-thumbnail.git#egg=sorl-thumbnail
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),
),
]
46 changes: 46 additions & 0 deletions imagersite/imager_images/migrations/0002_auto_20170131_1449.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-31 22:49
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_published',
field=models.DateTimeField(blank=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),
),
]
22 changes: 22 additions & 0 deletions imagersite/imager_images/migrations/0003_photo_tags.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-02 02:16
from __future__ import unicode_literals

from django.db import migrations
import taggit.managers


class Migration(migrations.Migration):

dependencies = [
('taggit', '0002_auto_20150616_2121'),
('imager_images', '0002_auto_20170131_1449'),
]

operations = [
migrations.AddField(
model_name='photo',
name='tags',
field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'),
),
]
Empty file.
71 changes: 71 additions & 0 deletions imagersite/imager_images/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
"""Album and Photo models."""
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
from taggit.managers import TaggableManager

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."""

tags = TaggableManager()
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)
date_modified = models.DateTimeField(auto_now=True)
date_published = models.DateTimeField(blank=True, null=True)
published = models.CharField(max_length=10, choices=PUBLISHED_OPTIONS, default='public')

def __str__(self):
"""Return string description of photo."""
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(blank=True, null=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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends 'imagersite/base.html' %}
{% block content %}
{% load bootstrap3 %}
<form method="POST" enctype="multipart/form-data">
{% bootstrap_form form %}
{% csrf_token %}
{% bootstrap_button "Submit" button_type="submit" button_class="btn-primary" %}
</form>
{% endblock content %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends 'imagersite/base.html' %}
{% block content %}
{% load bootstrap3 %}
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{% bootstrap_form form %}
{% bootstrap_button "Submit" button_type="submit" button_class="btn-primary" %}
</form>
{% endblock content %}
33 changes: 33 additions & 0 deletions imagersite/imager_images/templates/imager_images/album.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% 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 id="photo{{ photo.id }}" src="{{ photo.image.url }}" data-title="{{ photo.title }}" data-description="{{ photo.description }}"/>

{% for tag in photo.tags.all %}
<a href="{% url "imager_images:tagged_photos" tag.slug %}">{{ tag }}</a>
{% endfor %}

{% endfor %}
</div>
{{ album.description }}
<script>
(function() {
{% for photo in album.photos.all %}

var photo{{ photo.id }} = []

$('#photo{{ photo.id }}').attr("data-description", $('#photo{{ photo.id }}').attr("data-description") + " <br>Tags: ")
{% for tag in photo.tags.all %}
$('#photo{{ photo.id }}').attr("data-description", $('#photo{{ photo.id }}').attr("data-description") + "<a href='{% url "imager_images:tagged_photos" tag.slug %}'> {{ tag }}</a>" )
{% endfor %}

{% endfor %}
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="albums/{{ 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 %}
Loading