class EditCustomerView(View):
    def get(self, request, id):
        edit_obj = Customer.objects.get(pk=id)
        form = CustomerModelForm(instance = edit_obj)
        return render(request,'edit_customer.html', {'form':form})
        
    def post(self, request, id):
        edit_obj = Customer.objects.get(pk=id)
        form = CustomerModelForm(request.POST, instance = edit_obj)
        if form.is_valid():
            form.save()
            return redirect(reverse('customer_list'))
        else:
            return render(request, 'add_customer.html', {'form':form})