Commit 451aa8aa authored by Jose Luis Bautista's avatar Jose Luis Bautista

Moved to New Repo and Fixed path issues

Started app and started project  and problems are now okay
parent f0b7dfd8
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class BaudbConfig(AppConfig):
name = 'BauDB'
from django import forms
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)
\ No newline at end of file
from django.db import models
# Create your models here.
class key_model(models.Model):
keyName = models.CharField(max_length = 25)
keyDesc = models.CharField(max_length = 25)
from django.test import TestCase
# Create your tests here.
"""BauJo 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
from .views import page_home, page_profile, page_key, page_today, page_this_week, page_today, KeyListView
urlpatterns = [
#path('admin/', admin.site.urls),
path('', page_home, name = 'home'),
path('home/', page_home, name = 'home'),
path('profile/', page_profile, name = 'profile'),
path('key/', KeyListView.as_view(), name = 'key'),
path('this_week/', page_this_week, name = 'this_week'),
path('today/', page_today, name = 'today'),
]
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import View, ListView
from datetime import datetime
from .forms import home, profile, key, this_week, today
from .models import key_model
name = None
form = None
def page_home(request):
global name
global form
if name == None:
if request.method == 'POST':
form = home(request.POST)
if form.is_valid():
name = form.cleaned_data['name']
return render(request, 'home.html', {'form' : form, 'name' : name})
else:
form = home()
return render(request, 'home.html', {'form' : form})
else:
return render(request, 'home.html', {'form' : form, 'name' : name})
def page_profile(request):
return render(request, 'profile.html')
def page_key(request):
return render(request, 'key.html')
def page_this_week(request):
return render(request, 'this_week.html')
def page_today(request):
myDate = datetime.now()
formattedDate = myDate.strftime("%m.%d.%A")
return render(request, 'today.html', {'date': formattedDate})
class KeyListView(ListView):
model = key_model
template_name = 'key.html'
"""
ASGI config for BauJo 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', 'BauJo.settings')
application = get_asgi_application()
"""
Django settings for BauJo project.
Generated by 'django-admin startproject' using Django 3.1.8.
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/
"""
from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
APPEND_SLASH = False
# 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 = 'jujsasppa6td%qqu=r+he#0+(j==31$8o$-x+vfr$1i$z=d(ow'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'BauDB.apps.BaudbConfig',
'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 = 'BauJo.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'BauJo/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 = 'BauJo.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'database',
'USER': 'postgres',
'PASSWORD': 'user password',
'HOST': 'localhost',
'PORT': '5432',
}
}
# 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/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'BauJo/static')]
\ No newline at end of file
nav {
height: 80px;
width: 100%;
line-height: 40px;
overflow: auto;
background-color:black;
overflow: hidden;
}
nav ul{
float: center;
}
nav ul li{
display: inline-block;
list-style-type: none;
}
nav ul a{
text-decoration: none;
color: white;
padding: 35px;
}
nav ul a:hover{
background-color: rgb(34, 34, 34);
color: white;
}
nav ul a:active{
background-color: #4CAF50;
color: white;
}
\ No newline at end of file
<!DOCTYPE html>
{% load static %}
{% block styles %}
<link rel=stylesheet href="{% static 'style.css' %}">
{% endblock %}
<html>
<head>
<meta charest = "utf-8">
<meta name= "viewport" content = "width=device-width">
<title>{% block title %}{% endblock %}</title>
<h2 align = 'center'> {% block header %} {% endblock %} </h2>
<hr class="dotted">
</head>
<body>
<nav>
<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 'this_week' %}">This Week</a></li>
<li><a href = "{% url 'today' %}">Today</a></li>
</ul>
</nav>
{% block body %}
{% endblock %}
</body>
</html>
\ No newline at end of file
{% 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 url = "home" method = "POST">
{% csrf_token %}
{{ form }}
<input type="submit" name="submit" id = "submit" value = "Submit Name">
</form>
{% endif %}
{% endblock %}
{% extends 'base.html' %}
{% block title %}Key{% endblock %}
{% block header %}Key{% endblock %}
{% block body %}
<h3> • Tasks: Things you have to do </h3>
<h3> - Notes: Things you don't want to forget</h3>
<h3> O Events: Noteworthy moments in time </h3>
<h4> • Task incomplete </h4>
<h4> x Task complete </h4>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %}Profile{% endblock %}
{% block header %}Profile{% endblock %}
{% block body %}
<br>
<img src="{% static 'john.jpg' %}" width="600" height="400">
<h3> This is John Batungbacal. <br>He works at the SM department store as a sales representative. <br>He likes to play Mobile Legends and customizing his motorcycle.</h3>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}This Week{% endblock %}
{% block header %}This Week{% endblock %}
{% block body %}
<h1> 3.22.MON - 3.28.SUN </h1>
<h3> • Maglinis ng bahay </h3>
<h3> • Bolpen ni kapatid </h3>
<h3> • Charger wag kalimutan</h3>
<h3> - Mura lugaw dun sa may kanto malapit sa trike station </h3>
<h3> O (26) Date with bebe (whole day) </h3>
<h3> O (28) Ride with the boys pa MOA (whole day) </h3>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}Today{% endblock %}
{% block header %}Today{% endblock %}
{% block body %}
<h1> {{date}} </h1>
<h3> • Pabili ni baby </h3>
<h3> • NBI Clearance </h3>
<h3> - Pabili ni baby </h3>
<h3> - Mga sinampay, baka umulan </h3>
<h3> O ML league stream (8pm) </h3>
{% endblock %}
\ No newline at end of file
"""BauJo 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 include, path
urlpatterns = [
path('', include('BauDB.urls')),
path('admin/', admin.site.urls),
]
"""
WSGI config for BauJo 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', 'BauJo.settings')
application = get_wsgi_application()
#!/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', 'BauJo.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