def cost(request, offset):
    if request.method == 'POST':
        project = Project.objects.get(title=offset)
date = request.POST.get('date', '')
cost = request.POST.get('cost', '')
cost_obj = Cost(project=project, date=date, cost=cost)
cost_obj.save()
return HttpResponseRedirect('/')
How do I save data from a ModelForm to database in django?