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): ...@@ -16,6 +16,8 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)), ('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 ...@@ -3,15 +3,14 @@ from django.db import models
class Name(models.Model): class Name(models.Model):
name = models.CharField(max_length=100, unique=True) name = models.CharField(max_length=100, unique=True)
image = models.ImageField(upload_to=None)
nickname = models.CharField(max_length=50) nickname = models.CharField(max_length=50)
bio = models.CharField(max_length=200) bio = models.CharField(max_length=200, default='bobo ako')
def __str__(self): def __str__(self):
return '{} {} {}'.format(self.name, self.nickname, self.bio) return '{} {} {}'.format(self.name, self.nickname, self.bio)
def get_absolute_url(self): def get_absolute_url(self):
return reverse('string', args=[str(self.name)]) return reverse('name_detail', args=[str(self.name)])
@property @property
def is_tutorial(self): def is_tutorial(self):
......
...@@ -9,5 +9,7 @@ urlpatterns = [ ...@@ -9,5 +9,7 @@ urlpatterns = [
path('profile', profile, name = 'profile'), path('profile', profile, name = 'profile'),
path('key', key, name = 'key'), path('key', key, name = 'key'),
path('this_week', thisweek, name = 'thisweek'), 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.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.views import View from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .forms import * from .forms import *
from .models import *
name_dict = {} name_dict = {}
class NameListView(ListView):
model = Name
class NameDetailView(DetailView):
model = Name
class HomePageView(View): class HomePageView(View):
def get(self, request): def get(self, request):
form = IndexCardForm() form = IndexCardForm()
return render(request, 'base.html', {'form': form}) return render(request, 'index.html', {'form': form})
def index_card_view(request): def index_card_view(request):
global name_dict global name_dict
if len(name_dict) == 1: if len(name_dict) == 1:
return render(request, 'base.html', name_dict) return render(request, 'index.html', name_dict)
elif request.method == 'POST': elif request.method == 'POST':
form = IndexCardForm(request.POST) form = IndexCardForm(request.POST)
if form.is_valid(): if form.is_valid():
name_dict['name'] = form.cleaned_data['name'] name_dict['name'] = form.cleaned_data['name']
return render(request,'base.html', name_dict) return render(request,'index.html', name_dict)
else: else:
form = IndexCardForm() form = IndexCardForm()
return render(request, 'base.html', {'form': form}) return render(request, 'index.html', {'form': form})
def profile(request): def profile(request):
......
...@@ -3,20 +3,12 @@ ...@@ -3,20 +3,12 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name='viewport' content='width=device-width'> <meta name='viewport' content='width=device-width'>
<title>{% block title %}Your Bujo{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
{% block styles %}{% endblock %} {% block styles %}{% endblock %}
</head> </head>
<body> <body>
<h1> YOUR BULLET JOURNAL </h1> {% block content %}
{% if name %} {% endblock %}
<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 %}
<ul> <ul>
<li> <a href="{% url 'home'%}"> Home </a> </li> <li> <a href="{% url 'home'%}"> Home </a> </li>
<li> <a href="{% url 'profile'%}"> Profile </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' %} {% extends 'base.html' %}
{% load static %} {% load static %}
{% block title %} Your Bujo {% endblock %}
{% block styles %} {% 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 %} {% endblock %}
{% block content %} {% 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 %} {% endblock %}
\ No newline at end of file
<!DOCTYPE html> {% extends 'base.html' %}
<html>
<head> {% load static %}
<meta charset="utf-8"> {% block title %} Keys {% endblock %}
<meta name='viewport' content='width=device-width'> {% block styles %}
<title>{% block title %}Key{% endblock %}</title> <link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% block styles %}{% endblock %} {% endblock %}
</head>
<body> {% block content %}
<h1> Key </h1> <h1> Key </h1>
<p> ● Tasks: things you have to do </p> <p> ● Tasks: things you have to do </p>
<p> - Notes: things you don't want to forget </p> <p> - Notes: things you don't want to forget </p>
<p> ◦ Events: noteworth moments in time </p> <p> ◦ Events: noteworth moments in time </p>
<p> ● Task incomplete </p> <p> ● Task incomplete </p>
<p> x Task complete </p> <p> x Task complete </p>
{% block content %}{% endblock %} {% endblock %}
<ul> \ No newline at end of file
<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
{% extends 'base.html' %}
{% load static %} {% load static %}
{% block title %} Profile {% endblock %}
{% block styles %}
<link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% endblock %}
<!DOCTYPE html> {% block content %}
<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> <h1> Profile </h1>
<ul> <ul>
<li> Franz Leonard Atanacio </li> <li> Franz Leonard Atanacio </li>
...@@ -17,13 +14,4 @@ ...@@ -17,13 +14,4 @@
<li> di raw masyadong masarap pero pwede na </li> <li> di raw masyadong masarap pero pwede na </li>
</ul> </ul>
<img src="{% static 'img/picturekoparasalahat.jpg' %}" /> <img src="{% static 'img/picturekoparasalahat.jpg' %}" />
<ul> {% endblock %}
<li> <a href="{% url 'home'%}"> Home </a> </li> \ No newline at end of file
<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
<!DOCTYPE html> {% extends 'base.html' %}
<html>
<head> {% load static %}
<meta charset="utf-8"> {% block title %} Keys {% endblock %}
<meta name='viewport' content='width=device-width'> {% block styles %}
<title>{% block title %}This Week{% endblock %}</title> <link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% block styles %}{% endblock %} {% endblock %}
</head>
<body> {% block content %}
<h1> This Week </h1> <h1> This Week </h1>
<p> 03.29.MON - 04.04.SUN </p> <p> 03.29.MON - 04.04.SUN </p>
<p> - relax, holy week ngayon </p> <p> - relax, holy week ngayon </p>
<p> ● minecraft </p> <p> ● minecraft </p>
<p> - this is fake of course, go do your reqs </p> <p> - this is fake of course, go do your reqs </p>
<ul> {% endblock %}
<li> <a href="{% url 'home'%}"> Home </a> </li> \ No newline at end of file
<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
<!DOCTYPE html> {% extends 'base.html' %}
<html>
<head> {% load static %}
<meta charset="utf-8"> {% block title %} Keys {% endblock %}
<meta name='viewport' content='width=device-width'> {% block styles %}
<title>{% block title %}Today{% endblock %}</title> <link rel="stylesheet" href="{% static 'css/styles.css' %}" type='text/css'>
{% block styles %}{% endblock %} {% endblock %}
</head>
<body> {% block content %}
<h1> Today </h1> <h1> Today </h1>
<p> 03.30.TUES </p> <p> 03.30.TUES </p>
<p> ● lab 1 bujo </p> <p> ● lab 1 bujo </p>
{% block content %}{% endblock %} {% endblock %}
<ul> \ No newline at end of file
<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
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