Polished custom user model avatar photo

This commit is contained in:
Keannu Christian Bernasol 2023-06-26 20:42:22 +08:00
parent 87d30a0ecc
commit 49a69c6737
7 changed files with 99 additions and 3 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-26 12:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0003_customuser_avatar'),
]
operations = [
migrations.AlterField(
model_name='customuser',
name='avatar',
field=models.ImageField(null=True, upload_to='media/avatars'),
),
]

View file

@ -28,5 +28,5 @@ class CustomUser(AbstractUser):
max_length=50, choices=YEAR_LEVELS)
semester = models.CharField(
max_length=50, choices=SEMESTERS)
avatar = models.ImageField(upload_to='images', null=True)
avatar = models.ImageField(upload_to='media/avatars', null=True)
pass

View file

@ -160,6 +160,9 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = 'static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

View file

@ -16,8 +16,10 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/', include('api.urls'))
]
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB