Skip to content

Commit

Permalink
Merge pull request #22 from Rayliable/DisplayPhotos
Browse files Browse the repository at this point in the history
Dan added the "tag" filtered pages
  • Loading branch information
Krowno04 authored Mar 21, 2024
2 parents c673b9f + 7de17be commit 987a342
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 3 deletions.
Binary file added Media/user_upload/compressed/Avengers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/user_upload/compressed/Inception.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/user_upload/full_quality/Avengers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Media/user_upload/full_quality/Inception.jpg
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 db.sqlite3
Binary file not shown.
2 changes: 2 additions & 0 deletions home/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from django.db import models
from PIL import Image
from io import BytesIO


# Create your models here.

# user uploads mode (includes title, image, tags)
Expand Down
2 changes: 2 additions & 0 deletions home/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
path("upload_view/", views.upload_view, name="upload_view"),
path("about_us/", views.about, name="about_us"),
path("contact_us", views.contact, name="contact_us"),
path("photography/", views.photography, name="photography"),
path("illustration/", views.illustration, name="illustration"),
]
14 changes: 13 additions & 1 deletion home/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.shortcuts import render, redirect
from .forms import ImageForm, ImageFormURL

from .models import UserUpload, UserUploadURL

# Create your views here.

Expand Down Expand Up @@ -44,3 +44,15 @@ def url_upload(request): # page for users to upload images
else: # if invalid print errors
form = ImageForm()
return redirect("upload_view") # return to form view


def photography(request):
# Filter through images based on tag and privacy
filtered_images = UserUpload.objects.filter(tags='option_two', privacy='option_one')
return render(request, 'photography.html', {'images': filtered_images})


def illustration(request):
# Filter through images based on tag and privacy
filtered_images = UserUpload.objects.filter(tags='option_three', privacy='option_one')
return render(request, 'illustration.html', {'images': filtered_images})
4 changes: 2 additions & 2 deletions templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ <h4 style="font-size: 20px; text-align: center"> Browse Categories! </h4>
<!-- Scroll line for categories -->
<div class="categories">
<div class="categoryDisplay">
<a href="#"> <!-- links to the page of art -->
<a href="/photography"> <!-- links to the photography page -->
<img src="{% static 'placeHolderImage.png' %}" alt="img" class="categoryimg">
</a>
<a href="#"> <!-- links to the page of art -->
<a href="/illustration"> <!-- links to the illustration page -->
<img src="{% static 'placeHolderImage.png' %}" alt="img" class="categoryimg">
</a>
<a href="#"> <!-- links to the page of art -->
Expand Down
13 changes: 13 additions & 0 deletions templates/illustration.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Illustration </title>
</head>
<body>
<h1> Illustration </h1>
{% for image in images %} <!-- prints out all images -->
<img src="{{ image.image_compressed.url }}" alt="Image" style="width: 250px; height: 250px">
{% endfor %}
</body>
</html>
13 changes: 13 additions & 0 deletions templates/photography.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title> Photography </title>
</head>
<body>
<h1> Photography </h1>
{% for image in images %} <!-- prints out all images -->
<img src="{{ image.image_compressed.url }}" alt="Image" style="width: 250px; height: 250px">
{% endfor %}
</body>
</html>

0 comments on commit 987a342

Please sign in to comment.