python 2.7

Django Template Tag for Boolean Value  #angularjs #reactjs

  • I want to show the percentage of operators that are available.
  • I’m new to Django, and I’m stuck on a template tag that I can’t figure out how to get working.
  • @login_required(login_url=’login/’) def operator(request): operators = Operator.objects.all() operator_status = Operator.objects.values_list(‘is_available’, flat=True) context = { ‘operators’: operators, ‘operators_available’: operator_status, } return render(request, ‘content/operator.html’, context)
  • Stack Overflow works best with JavaScript enabled
  • sign up log in tour help

I’m new to Django, and I’m stuck on a template tag that I can’t figure out how to get working. I know I’m missing something in my view but I have written it in several different ways and can’t seem to find the right way to do this. I have a Morris chart in my app that I am trying to provide information to. I want to show the percentage of operators that are available. In my model, I have a Boolean value that says if the operator is_available. When I pass it back to the template I want the template tag to run the percentage and pass back the value to the morris pie chart.

@ng_real_ninja: Django Template Tag for Boolean Value #angularjs #reactjs

I’m new to Django, and I’m stuck on a template tag that I can’t figure out how to get working. I know I’m missing something in my view but I have written it in several different ways and can’t seem to find the right way to do this. I have a Morris chart in my app that I am trying to provide information to. I want to show the percentage of operators that are available. In my model, I have a Boolean value that says if the operator is_available. When I pass it back to the template I want the template tag to run the percentage and pass back the value to the morris pie chart.

Here is my view:

This is the template tag in use:

and finally my template tag:

“Once, twice, thrice,…”, what comes next?

python 2.7