Commit 58e6977f authored by nikkastra's avatar nikkastra

changing content

parent 83b24993
from django import forms from django import forms
class IndexCardForm(forms.Form): class IndexCardForm(forms.Form):
name = forms.CharField(label="Hello! What is your name? ", max_length=100) 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 ...@@ -2,26 +2,24 @@ from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import View from django.views import View
from .forms import IndexCardForm from .forms import *
class HomePageView(View): class HomePageView(View):
def get(self, request): def get(self, request):
form = IndexCardForm() form = IndexCardForm()
return render(request, 'index.html', {'form': form}) return render(request, 'base.html', {'form': form})
def index_card_view(request): def index_card_view(request):
if request.method == 'POST': if request.method == 'POST':
form = IndexCardForm(request.POST) form = IndexCardForm(request.POST)
if form.is_valid(): if form.is_valid():
return HttpResponse( return render(request,'base.html', {
'Hello, {}! Today is gonna be a great day!'.format( 'name':form.cleaned_data['name']
form.cleaned_data['name'] }
)
) )
else: else:
form = IndexCardForm() form = IndexCardForm()
return render(request, 'index.html', {'form': form}) return render(request, 'base.html', {'form': form})
def profile(request): def profile(request):
......
...@@ -8,12 +8,22 @@ ...@@ -8,12 +8,22 @@
</head> </head>
<body> <body>
<h1> YOUR BULLET JOURNAL </h1> <h1> YOUR BULLET JOURNAL </h1>
<form action="/home" method="post"> {% if name %}
{% csrf_token %} <p>Hello, {{name}}! Today is gonna be a great day!</p>
{{form}} {% else %}
<input type="Submit" value="Submit"> <form action="/home" method="post" id="nickname">
</form> {% csrf_token %}
{% block content %}{% endblock %} {{form}}
<input type="Submit" value="Submit">
</form>
{% 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 %} {% block scripts %}{% endblock %}
</body> </body>
</html> </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 @@ ...@@ -7,11 +7,5 @@
{% endblock %} {% endblock %}
{% block content %} {% 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 %} {% 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