Commit 58e6977f authored by nikkastra's avatar nikkastra

changing content

parent 83b24993
from django import forms
class IndexCardForm(forms.Form):
name = forms.CharField(label="Hello! What is your name? ", max_length=100)
\ No newline at end of file
......@@ -2,26 +2,24 @@ from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from .forms import IndexCardForm
from .forms import *
class HomePageView(View):
def get(self, request):
form = IndexCardForm()
return render(request, 'index.html', {'form': form})
return render(request, 'base.html', {'form': form})
def index_card_view(request):
if request.method == 'POST':
form = IndexCardForm(request.POST)
if form.is_valid():
return HttpResponse(
'Hello, {}! Today is gonna be a great day!'.format(
form.cleaned_data['name']
)
return render(request,'base.html', {
'name':form.cleaned_data['name']
}
)
else:
form = IndexCardForm()
return render(request, 'index.html', {'form': form})
return render(request, 'base.html', {'form': form})
def profile(request):
......
......@@ -8,12 +8,22 @@
</head>
<body>
<h1> YOUR BULLET JOURNAL </h1>
<form action="/home" method="post">
{% if name %}
<p>Hello, {{name}}! Today is gonna be a great day!</p>
{% else %}
<form action="/home" method="post" id="nickname">
{% csrf_token %}
{{form}}
<input type="Submit" value="Submit">
</form>
{% block content %}{% endblock %}
{% endif %}
<ul>
<li> <a href="{% url 'home'%}"> Home </a> </li>
<li> <a href="{% url 'profile'%}"> Profile </a> </li>
<li> <a href="{% url 'key'%}"> Key </a> </li>
<li> <a href="{% url 'thisweek'%}"> This Week </a> </li>
<li> <a href="{% url 'today'%}"> Today </a> </li>
</ul>
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}Your Bujo{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1> YOUR BULLET JOURNAL </h1>
{% if is_it_valid == 'True' %}
<p> 'Hello, {}! Today is gonna be a great day!'.format(
form.cleaned_data['name']) </p>
{% else %}
<form action="/home" method="post">
{% csrf_token %}
{{form}}
<input type="Submit" value="Submit">
</form>
{% endif %}
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
......@@ -7,11 +7,5 @@
{% endblock %}
{% block content %}
<ul>
<li> <a href="{% url 'home'%}"> Home </a> </li>
<li> <a href="{% url 'profile'%}"> Profile </a> </li>
<li> <a href="{% url 'key'%}"> Key </a> </li>
<li> <a href="{% url 'thisweek'%}"> This Week </a> </li>
<li> <a href="{% url 'today'%}"> Today </a> </li>
</ul>
{% endblock %}
\ No newline at end of file
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