Пример #1
0
def add_stock_comment(request):
    """This function adds comments to Comments table for a specific stock .

	**Template:**

	:template:'myapp/templates/signle_stock.html'
	"""
    if request.method == 'POST':

        if request.POST.get('name') and request.POST.get('content'):
            comment = Comment()
            comment.author = request.POST.get('name')
            comment.text = request.POST.get('content')
            comment.stock_id = request.POST.get('stock_symbol')
            symbol = request.POST.get('stock_symbol')
            comment.save()

            return HttpResponseRedirect(request.META.get('HTTP_REFERER'))