Commit 16f895ac authored by nikkastra's avatar nikkastra

fixing code

i now know how "extends" work
parent 0468b71e
......@@ -16,6 +16,8 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('nickname', models.CharField(max_length=50)),
('bio', models.CharField(max_length=200))
],
),
]
# Generated by Django 3.1.7 on 2021-04-07 16:54
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bulletjournal', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='name',
name='bio',
field=models.CharField(default='bobo ako', max_length=200),
),
migrations.AlterField(
model_name='name',
name='name',
field=models.CharField(max_length=100, unique=True),
),
migrations.CreateModel(
name='Tasks',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('key', models.CharField(max_length=2)),
('task', models.CharField(max_length=100)),
('name', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='bulletjournal.name')),
],
),
]
......@@ -3,15 +3,14 @@ from django.db import models
class Name(models.Model):
name = models.CharField(max_length=100, unique=True)
image = models.ImageField(upload_to=None)
nickname = models.CharField(max_length=50)
bio = models.CharField(max_length=200)
bio = models.CharField(max_length=200, default='bobo ako')
def __str__(self):
return '{} {} {}'.format(self.name, self.nickname, self.bio)
def get_absolute_url(self):
return reverse('string', args=[str(self.name)])
return reverse('name_detail', args=[str(self.name)])
@property
def is_tutorial(self):
......
......@@ -9,5 +9,7 @@ urlpatterns = [
path('profile', profile, name = 'profile'),
path('key', key, name = 'key'),
path('this_week', thisweek, name = 'thisweek'),
path('today', today, name = 'today')
path('today', today, name = 'today'),
path('name', NameListView.as_view(), name = 'name_list'),
path('name1/<int:pk>', NameDetailView.as_view(), name = 'name_list')
]
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .forms import *
from .models import *
name_dict = {}
class NameListView(ListView):
model = Name
class NameDetailView(DetailView):
model = Name
class HomePageView(View):
def get(self, request):
form = IndexCardForm()
return render(request, 'base.html', {'form': form})
return render(request, 'index.html', {'form': form})
def index_card_view(request):
global name_dict
if len(name_dict) == 1:
return render(request, 'base.html', name_dict)
return render(request, 'index.html', name_dict)
elif request.method == 'POST':
form = IndexCardForm(request.POST)
if form.is_valid():
name_dict['name'] = form.cleaned_data['name']
return render(request,'base.html', name_dict)
return render(request,'index.html', name_dict)
else:
form = IndexCardForm()
return render(request, 'base.html', {'form': form})
return render(request, 'index.html', {'form': form})
def profile(request):
......
......@@ -3,20 +3,12 @@
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}Your Bujo{% endblock %}</title>
<title>{% block title %}{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1> YOUR BULLET JOURNAL </h1>
{% if name %}
<p>Hello, {{name}}! Today is gonna be a great day!</p>
{% else %}
<form action="/home" method="post" id="nickname">
{% csrf_token %}
{{form}}
<input type="Submit" value="Submit">
</form>
{% endif %}
{% block content %}
{% endblock %}
<ul>
<li> <a href="{% url 'home'%}"> Home </a> </li>
<li> <a href="{% url 'profile'%}"> Profile </a> </li>
......
{% extends 'base.html' %}
{% block title %}Names{% endblock %}
{% block content %}
<ul>
{% if object_list %}
{% for name in object_list %}
<li>
<a href="{{name.get_absolute_url}}">{{name.name}}</a>
</li>
{% endfor %}
{% else %}
<h1> wala pa </h1>
{% endif %}
</ul>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} Your Bujo {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
{% block content %}
<h1> YOUR BULLET JOURNAL </h1>
{% if name %}
<p>Hello, {{name}}! Today is gonna be a great day!</p>
{% else %}
<form action="/home" method="post" id="nickname">
{% csrf_token %}
{{form}}
<input type="Submit" value="Submit">
</form>
{% endif %}
{% endblock %}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}Key{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1> Key </h1>
{% extends 'base.html' %}
{% load static %}
{% block title %} Keys {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
{% block content %}
<h1> Key </h1>
<p> ● Tasks: things you have to do </p>
<p> - Notes: things you don't want to forget </p>
<p> ◦ Events: noteworth moments in time </p>
<p> ● Task incomplete </p>
<p> x Task complete </p>
{% block content %}{% endblock %}
<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 %}
</body>
</html>
\ No newline at end of file
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% load static %}
{% block title %} Profile {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}Profile{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
{% block content %}{% endblock %}
<h1> Profile </h1>
{% block content %}
<h1> Profile </h1>
<ul>
<li> Franz Leonard Atanacio </li>
<li> "pogi" </li>
<li> di raw masyadong masarap pero pwede na </li>
</ul>
<img src="{% static 'img/picturekoparasalahat.jpg' %}" />
<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 %}
</body>
</html>
\ No newline at end of file
{% endblock %}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}This Week{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1> This Week </h1>
{% extends 'base.html' %}
{% load static %}
{% block title %} Keys {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
{% block content %}
<h1> This Week </h1>
<p> 03.29.MON - 04.04.SUN </p>
<p> - relax, holy week ngayon </p>
<p> ● minecraft </p>
<p> - this is fake of course, go do your reqs </p>
<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 content %}{% endblock %}
{% block scripts %}{% endblock %}
</body>
</html>
\ No newline at end of file
{% endblock %}
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name='viewport' content='width=device-width'>
<title>{% block title %}Today{% endblock %}</title>
{% block styles %}{% endblock %}
</head>
<body>
<h1> Today </h1>
{% extends 'base.html' %}
{% load static %}
{% block title %} Keys {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
{% block content %}
<h1> Today </h1>
<p> 03.30.TUES </p>
<p> ● lab 1 bujo </p>
{% block content %}{% endblock %}
<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 %}
</body>
</html>
\ No newline at end of file
{% 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