diff --git a/core/__pycache__/forms.cpython-311.pyc b/core/__pycache__/forms.cpython-311.pyc index ef4e8dd..d51bf4c 100644 Binary files a/core/__pycache__/forms.cpython-311.pyc and b/core/__pycache__/forms.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index 5575bf4..a2ff4fc 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index b6c116d..074aafd 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2669d1b..c15224f 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/forms.py b/core/forms.py index 6c13593..2cbb512 100644 --- a/core/forms.py +++ b/core/forms.py @@ -1,5 +1,13 @@ from django import forms -from .models import WardrobeItem, Accessory, Outfit, Category, OutfitFolder +from .models import WardrobeItem, Accessory, Outfit, Category, OutfitFolder, UserProfile + +class UserProfileForm(forms.ModelForm): + class Meta: + model = UserProfile + fields = ['avatar'] + widgets = { + 'avatar': forms.FileInput(attrs={'class': 'form-control bg-dark text-white border-secondary'}), + } class WardrobeItemForm(forms.ModelForm): main_category = forms.ModelChoiceField( @@ -163,4 +171,4 @@ class OutfitForm(forms.ModelForm): if commit: instance.save() self.save_m2m() - return instance \ No newline at end of file + return instance diff --git a/core/migrations/0004_userprofile.py b/core/migrations/0004_userprofile.py new file mode 100644 index 0000000..57acf88 --- /dev/null +++ b/core/migrations/0004_userprofile.py @@ -0,0 +1,24 @@ +# Generated by Django 5.2.7 on 2026-02-04 23:00 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0003_outfitfolder_is_preset'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='UserProfile', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('avatar', models.ImageField(blank=True, null=True, upload_to='avatars/')), + ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), + ], + ), + ] diff --git a/core/migrations/__pycache__/0004_userprofile.cpython-311.pyc b/core/migrations/__pycache__/0004_userprofile.cpython-311.pyc new file mode 100644 index 0000000..b6efa00 Binary files /dev/null and b/core/migrations/__pycache__/0004_userprofile.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 621a191..b7d19bd 100644 --- a/core/models.py +++ b/core/models.py @@ -1,7 +1,28 @@ from django.db import models +from django.contrib.auth.models import User +from django.db.models.signals import post_save +from django.dispatch import receiver import os from .utils import process_clothing_image +class UserProfile(models.Model): + user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile') + avatar = models.ImageField(upload_to='avatars/', null=True, blank=True) + + def __str__(self): + return f"{self.user.username}'s Profile" + +@receiver(post_save, sender=User) +def create_user_profile(sender, instance, created, **kwargs): + if created: + UserProfile.objects.get_or_create(user=instance) + +@receiver(post_save, sender=User) +def save_user_profile(sender, instance, **kwargs): + if not hasattr(instance, 'profile'): + UserProfile.objects.create(user=instance) + instance.profile.save() + class Category(models.Model): TYPE_CHOICES = [ ('wardrobe', 'Wardrobe'), @@ -102,4 +123,4 @@ class CalendarAssignment(models.Model): outfit = models.ForeignKey(Outfit, on_delete=models.CASCADE, related_name='assignments') def __str__(self): - return f"{self.date}: {self.outfit}" + return f"{self.date}: {self.outfit}" \ No newline at end of file diff --git a/core/templates/base.html b/core/templates/base.html index f154411..14f47b6 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -14,6 +14,7 @@ --bg-dark: #121212; --surface-dark: #1E1E1E; --primary-accent: #BB86FC; + --accent-lavender: #BB86FC; --secondary-accent: #03DAC6; --text-main: #E0E0E0; --text-dim: #9E9E9E; @@ -112,14 +113,14 @@ Outfits - - - Accs - Wardrobe + + + Accs + diff --git a/core/templates/core/accessory_list.html b/core/templates/core/accessory_list.html index 22554ee..8d8ae93 100644 --- a/core/templates/core/accessory_list.html +++ b/core/templates/core/accessory_list.html @@ -2,38 +2,59 @@ {% load static %} {% block content %} -
-
-

Accessories

- - Add Accessory +
+ + + +
+ + + +
+ -