Order current user to the top for admins
This commit is contained in:
parent
c991cd7882
commit
1bc6a5931e
1 changed files with 5 additions and 2 deletions
|
@ -30,8 +30,11 @@ class OrderForm(Form):
|
||||||
def populate(self) -> None:
|
def populate(self) -> None:
|
||||||
"Fill in the options for courier for an Order"
|
"Fill in the options for courier for an Order"
|
||||||
if current_user.is_admin():
|
if current_user.is_admin():
|
||||||
self.courier_id.choices = [(0, None)] + [
|
self.courier_id.choices = [
|
||||||
(u.id, u.username) for u in User.query.order_by("username")
|
(0, None),
|
||||||
|
(current_user.id, current_user.username),
|
||||||
|
] + [
|
||||||
|
(u.id, u.username) for u in User.query.order_by("username") if u.id != current_user.id
|
||||||
]
|
]
|
||||||
else:
|
else:
|
||||||
self.courier_id.choices = [
|
self.courier_id.choices = [
|
||||||
|
|
Loading…
Reference in a new issue