Commit 0f90756c authored by Dagebitten's avatar Dagebitten

Added Files

Needed to add files from base code due to issue with setting up Github. Still having error with Profile Page.
parent f3d1a697
Pipeline #1784 failed with stages
"""
ASGI config for abangan_lab1 project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'abangan_lab1.settings')
application = get_asgi_application()
from django import forms
class NameForm(forms.Form):
name = forms.CharField(label='Hello! What is your name? ',max_length=100)
\ No newline at end of file
"""
Django settings for abangan_lab1 project.
Generated by 'django-admin startproject' using Django 3.1.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'letp!1f^2ktwjivy%ft8hvgb_lf5&7-w7!5y8mb89&35zc-u7$'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'bujo.apps.BujoConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'abangan_lab1.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'abangan_lab1/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'abangan_lab1.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>{% block title %}{% endblock title %}</title>
<center><h1>{% block header %}{% endblock header %}</h1></center>
<hr>
</head>
<body>
<center>
<div class="navigation_buttons">
<button><a href="{% url 'bujo-home' %}">Home</a></button>
<button><a href="{% url 'bujo-profile' %}">Profile</a></button>
<button><a href="{% url 'bujo-key' %}">Key</a></button>
<button><a href="{% url 'bujo-week' %}">This Week</a></button>
<button><a href="{% url 'bujo-today' %}">Today</a></button>
</div>
</center>
<hr>
<br>
<div class="page_content" style="border:2px solid #000;">
<br>
{% block content %}{% endblock content%}
<br>
<br>
</div>
{% block scripts %}{% endblock scripts %}
</body>
</html>
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Your Bujo{% endblock title%}
{% block header %}Your Bullet Journal{% endblock header %}
{% block content %}
<center>
{% if request.method == "GET" %}
<form action="home" method="post" >
{% csrf_token %}
{{ form }}
<input type="submit" value="OK">
</form>
{% endif %}
</center>
{% if request.method == "POST" %}
<center>
<h3> Hello, {{ UserName }}! Today is going to be a great day! </h3>
</center>
{% endif %}
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Key{% endblock title %}
{% block header %}Key{% endblock header %}
{% block content %}
<center>
<h2>Tasks: things you have to do</h2>
<span>&#8226;</span> Tasks: Things you have to do<br>
<span>&#8259;</span> Notes: Things you don't want to forget<br>
<span>&#9900;</span> Events: Noteworthy moments in time<br>
<span>&#8226;</span> Task Incomplete<br>
<span>&#879;</span> Task Complete<br>
</center>
{% endblock content %}
{% extends "base.html" %}
{% load static %}
{% block title %}Profile{% endblock title %}
{% block header %}Profile{% endblock header %}
{% block content %}
<center>
<img src="{% static '' %}" style="width:100px;height:100px">
<p>This is you {{ UserName }}! Recorded to have been born at least once, congratulations!</p>
<p>Research finds that you have also been seen viewing this page!</p>
</center>
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}Today{% endblock title %}
{% block header %}Today{% endblock header %}
{% block content %}
<center>
<h2>04.10.SAT</h2>
<span>&#8226;</span> Finish viewing this website<br>
<span>&#9900;</span> Look at the code for this Website<br>
</center>
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% block title %}This Week{% endblock title %}
{% block header %}This Week{% endblock header %}
{% block content %}
<center>
<h2>04.10.SAT - 04.16.FRI</h2>
<span>&#8226;</span> Finish Academic-Related Work<br>
<span>&#8226;</span> Preparation for Grades<br>
<span>&#8226;</span> Attend to Course Evaluation<br>
<span>&#9900;</span> End of Semester Messages (?) <br>
</center>
{% endblock content %}
\ No newline at end of file
"""abangan_lab1 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('', include('bujo.urls')),
path('admin/', admin.site.urls),
]
\ No newline at end of file
"""
WSGI config for abangan_lab1 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'abangan_lab1.settings')
application = get_wsgi_application()
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class BujoConfig(AppConfig):
name = 'bujo'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path
from . import views
urlpatterns = [
path('home', views.home, name='bujo-home'),
path('profile', views.profile, name='bujo-profile'),
path('key', views.key, name='bujo-key'),
path('this_week', views.week, name='bujo-week'),
path('today', views.today, name='bujo-today'),
]
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from abangan_lab1.forms import NameForm
def home(request):
if request.method == 'POST':
form = NameForm(request.POST)
if form.is_valid():
UserName = form.cleaned_data["name"]
return render(request, 'HomePage.html', {'UserName' : UserName})
else:
return render(request, 'HomePage.html', {'form' : form})
else:
form = NameForm()
return render(request, 'HomePage.html', {'form' : form})
def profile(request):
return render(request, 'ProfilePage.html')
def key(request):
return render(request, 'KeyPage.html')
def week(request):
return render(request, 'WeekPage.html')
def today(request):
return render(request, 'TodayPage.html')
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'abangan_lab1.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
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