mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-22 06:19:38 +02:00
webp
This commit is contained in:
parent
7051fa749e
commit
c723d2836d
5 changed files with 44 additions and 3 deletions
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 5.0.6 on 2024-07-18 15:06
|
||||
|
||||
import django_resized.forms
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('adventures', '0008_collection_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='adventure',
|
||||
name='image',
|
||||
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='images/'),
|
||||
),
|
||||
]
|
|
@ -3,6 +3,7 @@ from django.db import models
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.forms import ValidationError
|
||||
from django_resized import ResizedImageField
|
||||
|
||||
ADVENTURE_TYPES = [
|
||||
('visited', 'Visited'),
|
||||
|
@ -28,7 +29,7 @@ class Adventure(models.Model):
|
|||
description = models.TextField(blank=True, null=True)
|
||||
rating = models.FloatField(blank=True, null=True)
|
||||
link = models.URLField(blank=True, null=True)
|
||||
image = models.ImageField(null=True, blank=True, upload_to='images/')
|
||||
image = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='images/')
|
||||
date = models.DateField(blank=True, null=True)
|
||||
is_public = models.BooleanField(default=False)
|
||||
longitude = models.DecimalField(max_digits=9, decimal_places=6, null=True, blank=True)
|
||||
|
|
|
@ -10,3 +10,4 @@ python-dotenv
|
|||
psycopg2-binary
|
||||
Pillow
|
||||
whitenoise
|
||||
django-resized
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 5.0.6 on 2024-07-18 15:06
|
||||
|
||||
import django_resized.forms
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='customuser',
|
||||
name='profile_pic',
|
||||
field=django_resized.forms.ResizedImageField(blank=True, crop=None, force_format='WEBP', keep_meta=True, null=True, quality=75, scale=None, size=[1920, 1080], upload_to='profile-pics/'),
|
||||
),
|
||||
]
|
|
@ -1,8 +1,9 @@
|
|||
from django.contrib.auth.models import AbstractUser
|
||||
from django.db import models
|
||||
from django_resized import ResizedImageField
|
||||
|
||||
class CustomUser(AbstractUser):
|
||||
profile_pic = models.ImageField(null=True, blank=True, upload_to='profile-pics/')
|
||||
profile_pic = ResizedImageField(force_format="WEBP", quality=75, null=True, blank=True, upload_to='profile-pics/')
|
||||
|
||||
def __str__(self):
|
||||
return self.username
|
Loading…
Add table
Add a link
Reference in a new issue