I've an error
Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
111. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/user/accounter/apps/accounter/views.py" in unit_view
24. return render(request, 'accounter/unit.html', context)
File "/usr/local/lib/python2.7/dist-packages/django/shortcuts.py" in render
48. return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/usr/local/lib/python2.7/dist-packages/django/template/loader.py" in render_to_string
177. with context_instance.push(dictionary):
File "/usr/local/lib/python2.7/dist-packages/django/template/context.py" in push
54. return ContextDict(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/django/template/context.py" in __init__
19. super(ContextDict, self).__init__(*args, **kwargs)
Exception Type: ValueError at /accounter/1/
Exception Value: dictionary update sequence element #0 has length 3; 2 is required
Also my view source code:
class ProductListView(generic.ListView):
model = Product
def get_queryset(self):
return Product.objects.all()
def unit_view(request, product_id):
context = Context({
'product': Product.objects.get(pk=product_id).name,
'ship_units': ShipUnit.objects.filter(product = product_id),
'shop_units': ShopUnit.objects.filter(product = product_id),
})
return render(request, 'accounter/unit.html', context)
I can't figure out what the problem. I've read documentation about using of render and context, also all the examples. But cant find where is my mistake.