Commit d95f5f5a authored by nikkastra's avatar nikkastra

atanacio_lab1 final

parent 58e6977f
Pipeline #1778 failed with stages
...@@ -4,19 +4,22 @@ from django.views import View ...@@ -4,19 +4,22 @@ from django.views import View
from .forms import * from .forms import *
name_dict = {}
class HomePageView(View): class HomePageView(View):
def get(self, request): def get(self, request):
form = IndexCardForm() form = IndexCardForm()
return render(request, 'base.html', {'form': form}) return render(request, 'base.html', {'form': form})
def index_card_view(request): def index_card_view(request):
if request.method == 'POST': global name_dict
if len(name_dict) == 1:
return render(request, 'base.html', name_dict)
elif request.method == 'POST':
form = IndexCardForm(request.POST) form = IndexCardForm(request.POST)
if form.is_valid(): if form.is_valid():
return render(request,'base.html', { name_dict['name'] = form.cleaned_data['name']
'name':form.cleaned_data['name'] return render(request,'base.html', name_dict)
}
)
else: else:
form = IndexCardForm() form = IndexCardForm()
return render(request, 'base.html', {'form': form}) return render(request, 'base.html', {'form': form})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment