Fakultas Ilmu Komputer UI

Commit 119a2ea1 authored by Ami's avatar Ami
Browse files

Merge branch 'staging' of...

Merge branch 'staging' of https://gitlab.cs.ui.ac.id/ppl-fasilkom-ui/2021/DD/pt-gizi-sehat-dietela/dietela-backend into linking-customuser-nutritionist
parents 12e71ce1 fbb27506
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import CustomUser from .models import CustomUser
admin.site.register(CustomUser)
class UserAdmin(BaseUserAdmin):
# The fields to be used in displaying the User model.
# These override the definitions on the base UserAdmin
# that reference specific fields on auth.User.
list_display = ('email',)
fieldsets = (
(None, {'fields': (\
'name',
'email',
'password',
'groups',
'diet_profile',
'nutritionist',
'date_joined',
'is_staff',
'is_active',
'is_superuser',
'user_permissions',
'last_login'
)}),
)
# add_fieldsets is not a standard ModelAdmin attribute. UserAdmin
# overrides get_fieldsets to use this attribute when creating a user.
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': (\
'name',
'email',
'password1',
'password2',
'groups',
'diet_profile',
'nutritionist',
'date_joined',
'is_staff',
'is_active',
'is_superuser',
'user_permissions',
'last_login'
)}
),
)
search_fields = ('email',)
ordering = ('email',)
admin.site.register(CustomUser, UserAdmin)
...@@ -211,5 +211,6 @@ REST_AUTH_REGISTER_SERIALIZERS = { ...@@ -211,5 +211,6 @@ REST_AUTH_REGISTER_SERIALIZERS = {
'REGISTER_SERIALIZER': 'authentication.serializers.CustomRegisterSerializer' 'REGISTER_SERIALIZER': 'authentication.serializers.CustomRegisterSerializer'
} }
URL_PREFIX = os.environ.get("URL_PREFIX", "")
MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/' MEDIA_URL = f'{URL_PREFIX}/media/'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment