One of my view needs to add an item, along with other functionality, but I already have another view which specifically adds an item.
Can I do something like:
def specific_add_item_view(request):
item = Item.objects.create(foo=request.bar)
def big_view(request):
# ...
specific_add_item_view(request)
View functions should return a rendered HTML back to the browser (in an
HttpResponse). Calling a view within a view means that you’re (potentially) doing the rendering twice. Instead, just factor out the “add” into another function that’s not a view, and have both views call it.