Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contact and about #36

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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/582810_1KoCYue0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
1 change: 1 addition & 0 deletions home/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


class ImageForm(forms.ModelForm): # upload form for file image

class Meta:
model = UserUpload
fields = ['title', 'image_upload', 'tags', 'privacy']
Expand Down
26 changes: 26 additions & 0 deletions home/migrations/0011_userupload_author_useruploadurl_author.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.0.3 on 2024-03-25 02:03

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


class Migration(migrations.Migration):

dependencies = [
('home', '0010_merge_20240323_2137'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.AddField(
model_name='userupload',
name='author',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='useruploadurl',
name='author',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
12 changes: 6 additions & 6 deletions home/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from PIL.Image import Image
from PIL import Image
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.db import models
from io import BytesIO
Expand Down Expand Up @@ -30,6 +30,7 @@ class UserUpload(models.Model):
image_compressed = models.ImageField(upload_to='user_upload/compressed', blank=True)
tags = models.CharField(max_length=30, choices=OPTIONS, default=untagged)
privacy = models.CharField(max_length=30, choices=OPTIONS2, default=public)
author = models.ForeignKey(User, on_delete=models.CASCADE, null=True)

# code modified off of Rowan's code from BIT2008 and
# code for saving into model modified from
Expand All @@ -42,14 +43,14 @@ def save(self, *args, **kwargs):

# Resize and save the compressed image
img.thumbnail((800, 800))
img.save(output_io, format='JPEG', quality=60) # Save with 60% quality
img.save(output_io, format='PNG', quality=60) # Save with 60% quality
output_io.seek(0)

# Save the compressed image to the compressed_image field
self.image_compressed = InMemoryUploadedFile(
output_io,
'ImageField', '{}.jpg'.format(self.image_upload.name.split('.')[0]),
'image/jpeg',
'ImageField', '{}.png'.format(self.image_upload.name.split('.')[0]),
'image/png',
sys.getsizeof(output_io),
None
)
Expand Down Expand Up @@ -80,8 +81,7 @@ class UserUploadURL(models.Model): # user upload for URL images
url_upload = models.URLField()
tags = models.CharField(max_length=30, choices=OPTIONS, default=untagged)
privacy = models.CharField(max_length=30, choices=OPTIONS2, default=public)

# uploader = models.ForeignKey(User, on_delete=models.CASCADE, null=True)
author = models.ForeignKey(User, on_delete=models.CASCADE, null=True)

def __str__(self):
return self.title
Binary file modified home/static/ChloeIcon.png
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 home/static/RayIcon.png
Binary file modified home/static/SetaishIcon.png
Loading
Loading