Commit 7b860f35 authored by Jose Luis Bautista's avatar Jose Luis Bautista

Fixed navibar issue and Added headers for all pages

Navibar used to append urls thereby stacking and creating errors, progress is being made
parent 207468fb
from django import forms from django import forms
class home(forms.Form): class home(forms.Form):
name = forms.CharField(label='Name: ', max_length = 25)
class profile(forms.Form):
name = forms.CharField(label='', max_length = 25)
class key(forms.Form):
name = forms.CharField(label='', max_length = 25)
class this_week(forms.Form):
name = forms.CharField(label='', max_length = 25)
class today(forms.Form):
name = forms.CharField(label='', max_length = 25) name = forms.CharField(label='', max_length = 25)
\ No newline at end of file
...@@ -16,7 +16,7 @@ import os ...@@ -16,7 +16,7 @@ import os
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
APPEND_SLASH = False
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
......
...@@ -8,14 +8,24 @@ ...@@ -8,14 +8,24 @@
<html> <html>
<head> <head>
<meta charest = "utf-8">
<meta name= "viewport" content = "width=device-width">
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
<nav> <nav>
<ul> <ul>
<li><a href="home/">Home</a></li> <li><a href = "{% url 'home' %}">Home</a></li>
<li><a href="profile/">Profile</a></li> <li><a href = "{% url 'profile' %}">Profile</a></li>
<li><a href = "{% url 'key' %}">Key</a></li>
<li><a href = "{% url 'this_week' %}">This Week</a></li>
<li><a href = "{% url 'today' %}">Today</a></li>
</ul> </ul>
</nav> </nav>
<h2> {% block header %} {% endblock %} </h2>
</head> </head>
<body> <body>
{% block body %}
{% endblock %}
</body> </body>
</html> </html>
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Your Bujo{% endblock %}
{% block header %}Your Bullet Journal{% endblock %}
{% block body %}
{% if name %}
<h1> Hello {{name}}! Today is going to be a great day! </h1>
{% else %}
<h1> Hello! What is your name? </h1>
<form action = "home/" method = "POST">
{% csrf_token %}
{{ form }}
<input type="submit" name="submit" id = "submit" value = "Submit Name">
</form>
{% endif %}
{% endblock %}
{% block title %}Key{% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Key{% endblock %} {% block title %}Key{% endblock %}
{% block header %}Key{% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Profile{% endblock %} {% block title %}Profile{% endblock %}
{% block header %}Profile{% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}This Week{% endblock %} {% block title %}This Week{% endblock %}
{% block header %}This Week{% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% block title %}Today{% endblock %} {% block title %}Today{% endblock %}
{% block header %}Today{% endblock %}
\ No newline at end of file
...@@ -16,13 +16,14 @@ Including another URLconf ...@@ -16,13 +16,14 @@ Including another URLconf
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path
from .views import index from .views import page_home, page_profile, page_key, page_today, page_this_week, page_today
urlpatterns = [ urlpatterns = [
#path('admin/', admin.site.urls), #path('admin/', admin.site.urls),
path('', index, name = 'index'), path('', page_home, name = 'home'),
path('home/', index, name = 'index'), path('home/', page_home, name = 'home'),
path('profile/', index, name = 'profile'), path('profile/', page_profile, name = 'profile'),
path('key/', page_key, name = 'key'),
path('this_week/', page_this_week, name = 'this_week'),
path('today/', page_today, name = 'today'),
] ]
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .forms import home from django.views import View
from .forms import home, profile, key, this_week, today
def index(request): def page_home(request):
form = home() form = home()
return render(request,'profile.html',{'home' : home}) # if request.method == 'POST':
# form = home(request.POST)
# else:
# form = home()
return render(request, 'home.html', {'form' : form})
def page_profile(request):
return render(request, 'profile.html',{'profile': profile})
def page_key(request):
return render(request, 'key.html',{'profile': profile})
def page_this_week(request):
return render(request, 'this_week.html',{'profile': profile})
def page_today(request):
return render(request, 'today.html',{'profile': profile})
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