Initial commit that merge both the front end and the API in the same repository

This commit is contained in:
Eliot Berriot 2017-06-23 23:00:42 +02:00
commit 76f98b74dd
285 changed files with 51318 additions and 0 deletions

View file

@ -0,0 +1,29 @@
from rest_framework import serializers
from . import models
class UserSerializer(serializers.ModelSerializer):
permissions = serializers.SerializerMethodField()
class Meta:
model = models.User
fields = [
'id',
'username',
'name',
'email',
'is_staff',
'is_superuser',
'permissions',
'date_joined',
]
def get_permissions(self, o):
perms = {}
for internal_codename, conf in o.relevant_permissions.items():
perms[conf['external_codename']] = {
'status': o.has_perm(internal_codename)
}
return perms