mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-28 16:25:44 +08:00
Polished custom user model avatar photo
This commit is contained in:
parent
87d30a0ecc
commit
49a69c6737
7 changed files with 99 additions and 3 deletions
18
stude/accounts/migrations/0004_alter_customuser_avatar.py
Normal file
18
stude/accounts/migrations/0004_alter_customuser_avatar.py
Normal 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'),
|
||||
),
|
||||
]
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
BIN
stude/media/media/avatars/Keannu.jpg
Normal file
BIN
stude/media/media/avatars/Keannu.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 137 KiB |
Loading…
Add table
Add a link
Reference in a new issue