Commit a58d0cb8 authored by Lance Andrei Tan's avatar Lance Andrei Tan

Commit for lab2

parent 591f5b34
...@@ -38,6 +38,7 @@ INSTALLED_APPS = [ ...@@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'apps'
] ]
MIDDLEWARE = [ MIDDLEWARE = [
...@@ -119,3 +120,11 @@ USE_TZ = True ...@@ -119,3 +120,11 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/ # https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
{% block content %}
<h1>Add a Key</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn primary">Post</button>
</div>
{% endblock %}
\ No newline at end of file
{% block content %}
<h1>Edit your Nickname and Bio</h1>
<br/><br/>
<div class="form-group">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button onclick="{% url 'profile' %}">Submit</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
{% block content %}
<h1>Add an Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST" enctype="multipart/form-data">
{% csrf_token %}
{{ form.as_p }}
<button onclick="{% url 'today' %}">Post</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
{% block content %}
<h1>Add an Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button onclick="{% url 'week' %}">Post</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
<title>Delete</title>
{% block content %}
<br/><br/>
<h3>Delete: </h3>
<div class="form-group">
<form method="POST">
{% csrf_token %}
<strong>Do you want to delete it?</strong>
<button class="btn btn secondary">Delete</button>
</div>
{% endblock %}
\ No newline at end of file
<title>Set to Default</title>
{% block content %}
<style>
a{
background-color: black;
color: white;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<h1>Set back to Default</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
<strong>Are you sure?</strong><br/>
<button class="btn btn secondary">Yes</button>
<a href="{% url 'profile' %}">No</a>
</div>
{% endblock %}
\ No newline at end of file
<title>Delete</title>
{% block content %}
<style>
a{
background-color: black;
color: white;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<h1>Delete Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
<strong>Are you sure you want to delete this?</strong><br/>
<button class="btn btn secondary">Yes</button> &nbsp;
<a href="{% url 'today' %}">No</a>
</div>
{% endblock %}
\ No newline at end of file
<title>Delete</title>
{% block content %}
<style>
a{
background-color: black;
color: white;
padding: 2px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
<h1>Delete Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
<strong>Are you sure you want to delete this?</strong><br/>
<button class="btn btn secondary">Yes</button> &nbsp;
<a href="{% url 'week' %}">No</a>
</div>
{% endblock %}
\ No newline at end of file
...@@ -7,14 +7,16 @@ ...@@ -7,14 +7,16 @@
<style> <style>
div {text-align: center;} div {text-align: center;}
</style> </style>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<center> <center>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<h1 style="text-align:center; color:white;">space</h1>
<header> <h1>Your Bullet Journal</h1> </header> <header> <h1>Your Bullet Journal</h1> </header>
<body> <body>
<p>Hello! What is your name?</p> <p>Hello! What is your name?</p>
...@@ -22,10 +24,10 @@ div {text-align: center;} ...@@ -22,10 +24,10 @@ div {text-align: center;}
Hello, {{name}}! Today is going to be a great day! <br> Hello, {{name}}! Today is going to be a great day! <br>
{% else %} {% else %}
<form action="/home" method = "POST"> <form action="/home" method = "POST">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}
<input type='submit' name ='Submit'> <input type='submit' name ='Submit'>
</form> </form>
{% endif %} {% endif %}
</body> </body>
</center> </center>
......
{% block title %} {% endblock %} {% block title %} {% endblock %}
{% block styles %}{% endblock %} {% block styles %}
{% endblock %}
{% block content %} {% block content %}
{{username}} {{username}}
{% endblock %} {% endblock %}
<div class=directory> <style>
<h3> a[id=links]{
<a href='home'> Home </a> &nbsp; &nbsp; background-color: blue;
<a href='profile'> Profile </a> &nbsp; &nbsp; color: white;
<a href='key'> Key </a> &nbsp; &nbsp; padding: 5px 10px;
<a href='this_week'> This Week </a> &nbsp; &nbsp; text-align: center;
<a href='today'> Today </a> &nbsp; &nbsp; text-decoration: none;
</h3> display: inline-block;
</div> }
</style>
<div class=directory>
<h3>
<a id="links" href="home"> Home </a> &nbsp; &nbsp;
<a id="links" href="profile"> Profile </a> &nbsp; &nbsp;
<a id="links" href="key"> Key </a> &nbsp; &nbsp;
<a id="links" href="week"> This Week </a> &nbsp; &nbsp;
<a id="links" href="today"> Today </a> &nbsp; &nbsp;
</h3>
</div>
{% extends 'hyperlinks.html' %} {% extends 'hyperlinks.html' %}
{% block content %} {% block content %}
<title> Key </title> <h1>Key</h1>
<title>Key</title>
<header>
<h1 style="font-size:500%; font-family:verdana;"> Key </h1>
</header>
<style> <style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
background-color:#00FF00
}
th, td {
padding: 10px;
width: 100px
}
a[id=add] {
background-color: black;
color: white;
padding: 7px 13px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style> </style>
<body> {% for post in object_list %}
<p1><b>&nbsp; &nbsp; Tasks:</b> things you have to do</p1> <br><br>
<p2><b> - &nbsp; &nbsp; Notes:</b> Things you don't want to forget </p2> <br><br>
<p3><b>&nbsp; &nbsp; Events:</b> Noteworth moments in time </p3> <br><br>
<p4><b>&nbsp; &nbsp; Tasks complete </p4> <br><br>
<p5><b> X &nbsp; &nbsp; Task incomplete </p5>
<table>
<tr>
<th>Key</th>
<th>Description</th>
</tr>
<tr>
<td><center>{{ post.title }}</center></td>
<td>{{ post.description }}</td>
</tr>
</table>
<a href="{% url 'delete_keypost' post.pk %}">Delete this Item</a><br/><br>
{% endfor %}
</body> <a id="add" class="nav-link" href="{% url 'add_keypost' %}">Add Key</a>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'hyperlinks.html' %} {% extends 'hyperlinks.html' %}
{% block content %} {% block content %}
<title> Profile </title> <h1>Profile</h1>
<title>Profile</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
background-color:#00FF00
}
<header> th, td {
<h1 style="font-size:500%; font-family:verdana;"> Profile </h1> padding: 10px;
</header> width: 100px
<img src="https://inteng-storage.s3.amazonaws.com/images/AUGUST/sizes/robert-wadlow-3_resize_md.jpg" alt="photo" width="500" height="600"> }
<p style="font-size:150%;"><b><u>My Name:</u></b> Robert Wadlow</p> </style>
<p style="font-size:150%;"><b><u>Who is Robert Wadlow:</u></b> He is the tallest man in the world.</p>
<img src="https://spng.subpng.com/20180402/qye/kisspng-computer-icons-user-login-gender-5ac29ccd8f04c2.0984432615227035655858.jpg" alt="photo" width="300" height="300">
<button>Change</button>
<br><br>
{% if object_list|length > 0 %}
{% for post in object_list %}
Nickname: {{post.nickname}} <a href="{% url 'update_profilepost' post.pk %}">Edit</a><br/>
Bio: {{post.bio}} <a href="{% url 'update_profilepost' post.pk %}">Edit</a><br/><br/>
<!-- <a href="{% url 'delete_profilepost' post.pk %}">Set to default</a> -->
{% endfor %}
{% else %}
Nickname: Your Nickname <a class="nav-link" href="{% url 'add_profilepost' %}">Edit</a><br/>
Bio: A short description about yourself. <a class="nav-link" href="{% url 'add_profilepost' %}">Edit</a>
{% endif %}
<br/>
{% endblock %} {% endblock %}
\ No newline at end of file
{% extends 'hyperlinks.html' %}
{% block content %}
<title> This Week </title>
<header>
<h1 style="font-size:500%; font-family:verdana;"> This Week </h1>
<h2> 03.15.MON - 03.21.SUN </h2>
</header>
<body>
<p2><b></b> buy magnum in sm </p> <br>
<p3><b></b> feed Zoey the dog </p> <br>
<p4><b></b> study history </p> <br>
<p5><b></b> don't skip meals </p> <br>
<p6><b></b> finish research project </p> <br>
<p7><b></b> exercise everyday at 4pm </p>
</body>
{% endblock %}
{% extends 'hyperlinks.html' %} {% extends 'hyperlinks.html' %}
{% block content %} {% block content %}
<h1>Today</h1>
<title>Today</title> <title>Today</title>
<p>04.07.WED</p>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
background-color:#00FF00
}
th, td {
padding: 10px;
width: 120px
}
a[id=delete], a[id=edit]{
background-color: red;
color: white;
padding: 3px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a[id=add] {
background-color: black;
color: white;
padding: 7px 13px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
{% for post in object_list %}
<table>
<tr>
<th>Item Type</th>
<th>Details</th>
<th>Edit:</th>
<th>Delete:</th>
<th></th>
</tr>
<tr>
<td><center>{{ post.item_type }}</center></td>
<td>{{ post.description }}</td>
<td><center><a id="edit" href="{% url 'update_todaypost' post.pk %}">Edit</a></center></td>
<td><center><a id="delete" href="{% url 'delete_todaypost' post.pk %}">Delete</a></center></td>
<td><center><button>Mark as Done</button></center></td>
</tr>
</table>
<br>
{% endfor %}
<header> <a id="add" href="{% url 'add_todaypost' %}">Add Item</a>
<h1 style="font-size:500%; font-family:verdana;"> Today </h1>
<h2> 03.17.WED </h2>
</header>
<body>
<p2><b></b> eat banana </p2> <br>
<p3><b></b> clean the pantry </p3> <br>
<p4><b></b> fold the clothes </p4> <br>
<p5><b></b> buy pork </p5> <br>
<p6><b></b> charge battery pack </p6> <br>
<p7><b></b> wipe the cabinet </p7>
</body>
{% endblock %} {% endblock %}
\ No newline at end of file
<title>Edit Post</title>
{% block content %}
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn secondary">Update</button>
</div>
{% endblock %}
\ No newline at end of file
<title>Edit Profile</title>
{% block content %}
<h1>Edit your Nickname and Bio</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn secondary">Submit</button>
</div>
{% endblock %}
\ No newline at end of file
<title>Edit Item Page</title>
{% block content %}
<h1>Update Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn secondary">Update</button>
</div>
{% endblock %}
\ No newline at end of file
<title>Edit Item Page</title>
{% block content %}
<h1>Update Item</h1>
<br/><br/>
<div class="form-group">
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<button class="btn btn secondary">Update</button>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'hyperlinks.html' %}
{% block content %}
<h1>This Week</h1>
<title>This Week</title>
<p>04.05.MON - 04.11.SUN</p>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
background-color:#00FF00
}
th, td {
padding: 10px;
width: 120px
}
a[id=delete], a[id=edit]{
background-color: red;
color: white;
padding: 3px 8px;
text-align: center;
text-decoration: none;
display: inline-block;
}
a[id=add] {
background-color: black;
color: white;
padding: 7px 13px;
text-align: center;
text-decoration: none;
display: inline-block;
}
</style>
{% for post in object_list %}
<table>
<tr>
<th>Item Type</th>
<th>Details</th>
<th>Edit:</th>
<th>Delete:</th>
<th></th>
</tr>
<tr>
<td><center>{{ post.item_type }}</center></td>
<td>{{ post.description }}</td>
<td><center><a id="edit" href="{% url 'update_weekpost' post.pk %}">Edit</a></center></td>
<td><center><a id="delete" href="{% url 'delete_weekpost' post.pk %}">Delete</a></center></td>
<td><center><button>Mark as Done</button></center></td>
</tr>
</table>
<br>
{% endfor %}
<a id="add" href="{% url 'add_weekpost' %}">Add Item</a>
{% endblock %}
\ No newline at end of file
from django.contrib import admin from django.contrib import admin
from .models import *
admin.site.register(Profile)
admin.site.register(Key)
admin.site.register(Week)
admin.site.register(Today)
# Register your models here.
from django import forms from django import forms
from .models import *
class Name_Form(forms.Form): class Name_Form(forms.Form):
name_input = forms.CharField(label='Name:', max_length=50) name_input = forms.CharField(label='Name:', max_length=50)
class TaskForm(forms.ModelForm):
class Meta:
model = Profile
fields = '__all__'
class KeyForm(forms.ModelForm):
class Meta:
model = Key
fields = '__all__'
class WeekForm(forms.ModelForm):
class Meta:
model = Week
fields = '__all__'
class ProfileForm(forms.ModelForm):
class Meta:
model = Profile
fields = '__all__'
class TodayForm(forms.ModelForm):
class Meta:
model = Today
fields = '__all__'
# Generated by Django 3.1.7 on 2021-04-04 07:00
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='PostKey',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('body', models.TextField(max_length=255)),
],
),
migrations.CreateModel(
name='PostProfile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(max_length=255)),
('nickname', models.TextField(default='Your Nickname', max_length=100, null=True)),
('bio', models.TextField(default='A short description about yourself.', max_length=100)),
],
),
migrations.CreateModel(
name='PostToday',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('itemtype1', models.CharField(choices=[('Task', 'Task'), ('Event', 'Event'), ('Note', 'Note')], default='Task', max_length=50)),
('title', models.CharField(max_length=255)),
('body', models.TextField(max_length=255)),
],
),
migrations.CreateModel(
name='PostWeek',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('itemtype', models.CharField(choices=[('Task', 'Task'), ('Event', 'Event'), ('Note', 'Note')], default='Task', max_length=50)),
('title', models.CharField(max_length=255)),
('body', models.TextField(max_length=255)),
],
),
]
# Generated by Django 3.1.7 on 2021-04-06 14:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='postkey',
old_name='body',
new_name='details',
),
migrations.RenameField(
model_name='posttoday',
old_name='body',
new_name='details',
),
migrations.RenameField(
model_name='postweek',
old_name='body',
new_name='details',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0002_auto_20210406_2203'),
]
operations = [
migrations.RenameField(
model_name='postkey',
old_name='details',
new_name='description',
),
migrations.RenameField(
model_name='postweek',
old_name='details',
new_name='description',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0003_auto_20210407_1118'),
]
operations = [
migrations.RenameField(
model_name='posttoday',
old_name='itemtype1',
new_name='itemtype',
),
migrations.RemoveField(
model_name='posttoday',
name='title',
),
migrations.RemoveField(
model_name='postweek',
name='title',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0004_auto_20210407_1140'),
]
operations = [
migrations.RenameField(
model_name='posttoday',
old_name='itemtype',
new_name='item_type',
),
migrations.RenameField(
model_name='postweek',
old_name='itemtype',
new_name='item_type',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0005_auto_20210407_1140'),
]
operations = [
migrations.RenameField(
model_name='posttoday',
old_name='details',
new_name='description',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0006_auto_20210407_1149'),
]
operations = [
migrations.RemoveField(
model_name='postprofile',
name='title',
),
]
# Generated by Django 3.1.7 on 2021-04-07 03:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0007_remove_postprofile_title'),
]
operations = [
migrations.AlterField(
model_name='postprofile',
name='nickname',
field=models.CharField(default='Your Nickname', max_length=100, null=True),
),
]
# Generated by Django 3.1.7 on 2021-04-07 04:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apps', '0008_auto_20210407_1159'),
]
operations = [
migrations.AddField(
model_name='postprofile',
name='upload',
field=models.ImageField(blank=True, default='duffy.jpg', null=True, upload_to='images/'),
),
]
# Generated by Django 3.1.7 on 2021-04-07 04:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0009_postprofile_upload'),
]
operations = [
migrations.RenameModel(
old_name='PostKey',
new_name='Key',
),
migrations.RenameModel(
old_name='PostProfile',
new_name='Profile',
),
migrations.RenameModel(
old_name='PostToday',
new_name='Today',
),
migrations.RenameModel(
old_name='PostWeek',
new_name='Week',
),
]
# Generated by Django 3.1.7 on 2021-04-07 05:51
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('apps', '0010_auto_20210407_1221'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='upload',
),
]
from django.db import models from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse
# Create your models here. class Key(models.Model):
title = models.CharField(max_length=255)
description = models.TextField(max_length=255)
def _str_(self):
return self.title
def get_absolute_url(self):
return reverse('key')
class Week(models.Model):
menu = (
('Task', 'Task'),
('Event', 'Event'),
('Note', 'Note'),
)
item_type = models.CharField(max_length=50, choices=menu, default='Task')
description = models.TextField(max_length=255)
def _str_(self):
return self.itemtype
def get_absolute_url(self):
return reverse('week')
class Profile(models.Model):
#upload = models.ImageField(null=True, blank=True, default='duffy.jpg', upload_to ='images/')
nickname = models.CharField(max_length=100, null=True, default="Your Nickname")
bio = models.TextField(max_length=100, default="A short description about yourself.")
def _str_(self):
return self.nickname
def get_absolute_url(self):
return reverse('profile')
class Today(models.Model):
menu = (
('Task', 'Task'),
('Event', 'Event'),
('Note', 'Note'),
)
item_type = models.CharField(max_length=50, choices=menu, default='Task')
description = models.TextField(max_length=255)
def _str_(self):
return self.title
def get_absolute_url(self):
return reverse('today')
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import home from . import views
from .views import profile from .views import *
from .views import key
from .views import this_week
from .views import today
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
path('home', home, name="home"), path('home', home, name="homepage"),
path('profile', profile,name="profile"), path('homepage', home, name="homepage"),
path('key',key, name="key"), path('key', HomeKeyView.as_view(), name="key"),
path('this_week', this_week,name="this_week"), path('add_keypost/', AddKeyView.as_view(), name='add_keypost'),
path('today', today,name="today") path('key/edit/<int:pk>', UpdateKeyView.as_view(), name='update_keypost'),
] path('key/<int:pk>/remove', DeleteKeyView.as_view(), name='delete_keypost'),
path('week', HomeWeekView.as_view(), name="week"),
path('add_weekpost/', AddWeekView.as_view(), name='add_weekpost'),
path('week/edit/<int:pk>', UpdateWeekView.as_view(), name='update_weekpost'),
path('week/<int:pk>/remove', DeleteWeekView.as_view(), name='delete_weekpost'),
path('profile', HomeProfileView.as_view(), name="profile"),
path('add_profilepost/', AddProfileView.as_view(), name='add_profilepost'),
path('profile/edit/<int:pk>', UpdateProfileView.as_view(), name='update_profilepost'),
path('profile/<int:pk>/remove', DeleteProfileView.as_view(), name='delete_profilepost'),
path('today', HomeTodayView.as_view(), name="today"),
path('add_todaypost/', AddTodayView.as_view(), name='add_todaypost'),
path('today/edit/<int:pk>', UpdateTodayView.as_view(), name='update_todaypost'),
path('today/<int:pk>/remove', DeleteTodayView.as_view(), name='delete_todaypost'),
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.shortcuts import render from django.shortcuts import render, redirect
from django.http import HttpResponse from django.views.generic import *
from .forms import Name_Form from .models import *
from .forms import *
from django.urls import reverse_lazy
def home(request): def home(request):
if request.method == 'POST': if request.method == 'POST':
form = Name_Form(request.POST) form = Name_Form(request.POST)
if form.is_valid(): if form.is_valid():
return render(request, 'home.html', {'name': form.cleaned_data['name_input']}) return render(request, 'homepage.html', {'name': form.cleaned_data['name_input']})
else: else:
form = Name_Form() form = Name_Form()
return render(request, 'home.html', {'form': form}) return render(request, 'homepage.html', {'form': form})
def profile(request):
return render(request,'profile.html') class HomeKeyView(ListView):
def key(request): model = Key
return render(request,'key.html') template_name = 'key.html'
def this_week(request):
return render(request,'thisweek.html')
def today(request): class AddKeyView(CreateView):
return render(request,'today.html') model = Key
form_class = KeyForm
template_name = 'add_keypost.html'
class UpdateKeyView(UpdateView):
model = Key
form_class = KeyForm
template_name = 'update_keypost.html'
class DeleteKeyView(DeleteView):
model = Key
template_name = 'delete_keypost.html'
success_url = reverse_lazy('key')
class HomeWeekView(ListView):
model = Week
template_name = 'week.html'
class AddWeekView(CreateView):
model = Week
form_class = WeekForm
template_name = 'add_weekpost.html'
class UpdateWeekView(UpdateView):
model = Week
form_class = WeekForm
template_name = 'update_weekpost.html'
class DeleteWeekView(DeleteView):
model = Week
template_name = 'delete_weekpost.html'
success_url = reverse_lazy('week')
class HomeProfileView(ListView):
model = Profile
template_name = 'profile.html'
class AddProfileView(CreateView):
model = Profile
form_class = ProfileForm
template_name = 'add_profilepost.html'
class UpdateProfileView(UpdateView):
model = Profile
form_class = ProfileForm
template_name = 'update_profilepost.html'
class DeleteProfileView(DeleteView):
model = Profile
template_name = 'delete_profilepost.html'
success_url = reverse_lazy('profile')
class HomeTodayView(ListView):
model = Today
template_name = 'today.html'
class AddTodayView(CreateView):
model = Today
form_class = TodayForm
template_name = 'add_todaypost.html'
class UpdateTodayView(UpdateView):
model = Today
form_class = TodayForm
template_name = 'update_todaypost.html'
class DeleteTodayView(DeleteView):
model = Today
template_name = 'delete_todaypost.html'
success_url = reverse_lazy('today')
No preview for this file type
This diff is collapsed.
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