summaryrefslogtreecommitdiffstats
path: root/dashboard/src/booking/lib.py
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-05-31 20:01:57 +0000
committerGerrit Code Review <gerrit@opnfv.org>2019-05-31 20:01:57 +0000
commitf8c129df82adb3ffcbd51ebd42a3152196db38d6 (patch)
treeae3fc2f03b95a68df786dab1ac2711279c6f3873 /dashboard/src/booking/lib.py
parent2fb0bca997efd1090ddf3857cc2f983cb6f75f78 (diff)
parent6f0d21ca0cbb2ccd0ec9a1f9eb0b50a8305389cf (diff)
Merge "Refactor selector step logic"
Diffstat (limited to 'dashboard/src/booking/lib.py')
-rw-r--r--dashboard/src/booking/lib.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/dashboard/src/booking/lib.py b/dashboard/src/booking/lib.py
new file mode 100644
index 0000000..8132c75
--- /dev/null
+++ b/dashboard/src/booking/lib.py
@@ -0,0 +1,36 @@
+##############################################################################
+# Copyright (c) 2019 Parker Berberian, Sawyer Bergeron, and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from account.models import UserProfile
+
+
+def get_user_field_opts():
+ return {
+ 'show_from_noentry': False,
+ 'show_x_results': 5,
+ 'results_scrollable': True,
+ 'selectable_limit': -1,
+ 'placeholder': 'Search for other users',
+ 'name': 'users',
+ 'disabled': False
+ }
+
+
+def get_user_items(exclude=None):
+ qs = UserProfile.objects.select_related('user').exclude(user=exclude)
+ items = {}
+ for up in qs:
+ item = {
+ 'id': up.id,
+ 'expanded_name': up.full_name,
+ 'small_name': up.user.username,
+ 'string': up.email_addr
+ }
+ items[up.id] = item
+ return items