from django.shortcuts import render,redirect
from dailyexpense.models import Expense
# How to insert data into a database from an HTML form in Django
def expenseformview(request):
    if request.method == 'POST':
        if request.POST.get('exdate') \
                and request.POST.get('cost'):
            costs = Expense()
            costs.exdate = request.POST.get('exdate')
            costs.cost = request.POST.get('cost')

            costs.save()
            return redirect('dailyexpense')
    else:
        return render(request, 'DailyExpense.html')
cd7bc22065f3d108e3baae9efa952b11d17aa229
<mask token>

<mask token>


def expenseformview(request):
    if request.method == 'POST':
        if request.POST.get('exdate') and request.POST.get('cost'):
            costs = Expense()
            costs.exdate = request.POST.get('exdate')
            costs.cost = request.POST.get('cost')
            costs.save()
            return redirect('dailyexpense')
    else:
        return render(request, 'DailyExpense.html')

from django.shortcuts import render, redirect
from dailyexpense.models import Expense


def expenseformview(request):
    if request.method == 'POST':
        if request.POST.get('exdate') and request.POST.get('cost'):
            costs = Expense()
            costs.exdate = request.POST.get('exdate')
            costs.cost = request.POST.get('cost')
            costs.save()
            return redirect('dailyexpense')
    else:
        return render(request, 'DailyExpense.html')

from django.shortcuts import render,redirect
from dailyexpense.models import Expense
# How to insert data into a database from an HTML form in Django
def expenseformview(request):
    if request.method == 'POST':
        if request.POST.get('exdate') \
                and request.POST.get('cost'):
            costs = Expense()
            costs.exdate = request.POST.get('exdate')
            costs.cost = request.POST.get('cost')

            costs.save()
            return redirect('dailyexpense')
    else:
        return render(request, 'DailyExpense.html')