Skip to content

Commit

Permalink
Improves order app
Browse files Browse the repository at this point in the history
Está relacionado a Issue #18
  • Loading branch information
tiagocordeiro committed Mar 27, 2021
1 parent 9739db8 commit 4be2420
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion core/templatetags/core_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

@register.filter(name='has_group')
def has_group(user, group_name):
return user.groups.filter(name=group_name).exists()
try:
return user.groups.filter(name=group_name).exists()
except AttributeError:
return False


@register.filter(name='subtotal')
Expand Down
3 changes: 2 additions & 1 deletion orders/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ def orders_list(request):
pass

else:
orders = Order.objects.all().filter(restaurant__manager=request.user).order_by('-modified').exclude(status="pending")
orders = Order.objects.all().filter(restaurant__manager=request.user).order_by('-modified').exclude(
status="pending")

return render(request, template, {'orders': orders, 'order_slug': order_slug, 'cart_items': cart_items})

Expand Down

0 comments on commit 4be2420

Please sign in to comment.