Skip to content
Snippets Groups Projects
Commit ae471257 authored by Jean-Baptiste's avatar Jean-Baptiste
Browse files

update: expose User.serializer_fields

parent 412e80f5
No related branches found
No related tags found
No related merge requests found
Pipeline #390 passed
......@@ -3,7 +3,7 @@ from importlib import import_module
from django.conf import settings
from django.conf.urls import url, include
from django.contrib.auth.models import Group
from django.contrib.auth.models import Group, User
from djangoldp.views import LDPViewSet
from djangoldp.permissions import AnonymousReadOnly
......@@ -11,9 +11,8 @@ from .models import ChatProfile, Account
from .views import userinfocustom
djangoldp_modules = list(filter(lambda app: app.startswith('djangoldp_'), settings.INSTALLED_APPS))
user_fields = ['@id', 'first_name', 'groups', 'last_name', 'username', 'email', 'profile', 'account',
'ldnotification_set', 'chatProfile', 'name']
user_nested_fields = ['account', 'profile', 'groups', 'ldnotification_set', 'chatProfile']
user_fields = ['@id', 'first_name', 'groups', 'last_name', 'username', 'email', 'account', 'chatProfile', 'name']
user_nested_fields = ['account', 'groups', 'chatProfile']
for dldp_module in djangoldp_modules:
try:
user_fields += import_module(dldp_module + '.settings').USER_NESTED_FIELDS
......@@ -31,3 +30,9 @@ urlpatterns = [
url(r'^openid/userinfo', userinfocustom),
url(r'^openid/', include('oidc_provider.urls', namespace='oidc_provider')),
]
s_fields = []
s_fields.extend(user_fields)
s_fields.extend(user_nested_fields)
User._meta.serializer_fields = s_fields
Group._meta.serializer_fields = ['name']
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment