Allow MetadataLookup to receive callables. Update the {{ users }} and {{ groups }} metadata lookup options to be callables that return a current list of users and groups and not a queryset. Add integrations test user_managements -> metadata app. Fixes GitLab #290. Thanks to @camiloforero for finding this one.

This commit is contained in:
Roberto Rosario
2016-05-19 19:33:58 -04:00
parent 4de3bb99e2
commit d1c87fe102
3 changed files with 79 additions and 4 deletions
+11 -3
View File
@@ -22,6 +22,14 @@ from .links import (
)
def get_groups():
return ','.join([group.name for group in Group.objects.all()])
def get_users():
return ','.join([user.get_full_name() or user.username for user in get_user_model().objects.all()])
class UserManagementApp(MayanAppConfig):
app_url = 'accounts'
name = 'user_management'
@@ -36,12 +44,12 @@ class UserManagementApp(MayanAppConfig):
APIEndPoint(app=self, version_string='1')
MetadataLookup(
description=_('All the groups.'), name='group',
value=Group.objects.all()
description=_('All the groups.'), name='groups',
value=get_groups
)
MetadataLookup(
description=_('All the users.'), name='users',
value=User.objects.all()
value=get_users
)
SourceColumn(