Show multiple accounts in accountmodal
This commit is contained in:
@@ -81,22 +81,24 @@ def accounting_confirm(request, pk):
|
||||
def account_modal_view(request, loc_pk):
|
||||
try:
|
||||
uuids = Client.objects.filter(report_user=request.user).values_list('uuid')
|
||||
account = Accounting.objects.filter(reporter_uuid__in=uuids).first
|
||||
accounts = Accounting.objects.filter(reporter_uuid__in=uuids)
|
||||
# TODO: support multiple account objects
|
||||
except Client.DoesNotExist:
|
||||
account = None
|
||||
accounts = None
|
||||
context = {
|
||||
'account': account,
|
||||
'accounts': accounts,
|
||||
'loc_pk': loc_pk,
|
||||
'pks': ','.join([account.pk for account in accounts]),
|
||||
}
|
||||
return render(request, 'billard/accountmodal.html', context=context)
|
||||
|
||||
|
||||
@login_required
|
||||
def account_modal_confirm_view(request, loc_pk, pk):
|
||||
account = Accounting.objects.get(pk=pk)
|
||||
account.reporter_uuid = None
|
||||
account.save()
|
||||
def account_modal_confirm_view(request, loc_pk, pks):
|
||||
for pk in pks.split(','):
|
||||
account = Accounting.objects.get(pk=pk)
|
||||
account.reporter_uuid = None
|
||||
account.save()
|
||||
return redirect('billard:location_detail', pk=loc_pk)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user