-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Django version update Mostly documentation links and minor changes * Run isort * Move requirements into root folder * Add new readme * Add formatted migrations * Add CSS file * Add templates * Removed test files * Add placeholder content for empty file * Remove docstring from urls.py files
- Loading branch information
Showing
65 changed files
with
378 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
asgiref==3.8.1 | ||
Django==5.1.4 | ||
sqlparse==0.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 22 additions & 10 deletions
32
django-diary/source_code_final/entries/migrations/0001_initial.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,36 @@ | ||
# Generated by Django 3.2.1 on 2021-05-09 17:12 | ||
# Generated by Django 5.1.4 on 2025-01-06 17:01 | ||
|
||
from django.db import migrations, models | ||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
dependencies = [] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Entry', | ||
name="Entry", | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('title', models.CharField(max_length=200)), | ||
('content', models.TextField()), | ||
('date_created', models.DateTimeField(default=django.utils.timezone.now)), | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("title", models.CharField(max_length=200)), | ||
("content", models.TextField()), | ||
( | ||
"date_created", | ||
models.DateTimeField(default=django.utils.timezone.now), | ||
), | ||
], | ||
options={ | ||
"verbose_name_plural": "Entries", | ||
}, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,6 @@ h2, h3 { | |
} | ||
|
||
h2 { | ||
/* background-color: lightpink; */ | ||
background-color: aquamarine; | ||
} | ||
|
||
|
50 changes: 23 additions & 27 deletions
50
django-diary/source_code_final/entries/templates/entries/base.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
{% load static %} | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>My Diary</title> | ||
<link rel="stylesheet" href="{% static 'css/diary.css' %}"> | ||
</head> | ||
|
||
<body> | ||
<h1><a href="/">Dear diary …</a></h1> | ||
|
||
{% if messages %} | ||
<ul class="messages"> | ||
{% for message in messages %} | ||
<li class="message"> | ||
{{ message }} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
|
||
{% block content %}{% endblock %} | ||
|
||
<hr> | ||
<a href="{% url 'admin:logout' %}">Logout</a> | ||
</body> | ||
|
||
</html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>My Diary</title> | ||
<link rel="stylesheet" href="{% static 'css/diary.css' %}"> | ||
</head> | ||
<body> | ||
<h1> | ||
<a href="/">Dear diary …</a> | ||
</h1> | ||
{% if messages %} | ||
<ul class="messages"> | ||
{% for message in messages %}<li class="message">{{ message }}</li>{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{% block content %} | ||
{% endblock content %} | ||
<hr> | ||
<form method="post" action="{% url 'admin:logout' %}"> | ||
{% csrf_token %} | ||
<input type="submit" value="Logout" /> | ||
</form> | ||
</body> | ||
</html> |
8 changes: 5 additions & 3 deletions
8
django-diary/source_code_final/entries/templates/entries/entry_confirm_delete.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
{% extends "entries/base.html" %} | ||
{% block content %} | ||
<form method="post">{% csrf_token %} | ||
<form method="post"> | ||
{% csrf_token %} | ||
<p> | ||
Are you sure you want to delete <em>"{{ entry.title }}"</em><br> | ||
Are you sure you want to delete | ||
<em>"{{ entry.title }}"</em> | ||
created on {{ entry.date_created|date:'Y-m-d' }}? | ||
</p> | ||
<input type="submit" value="Confirm"> | ||
</form> | ||
<a href="{% url 'entry-detail' entry.id %}"> | ||
<button>Cancel</button> | ||
</a> | ||
{% endblock %} | ||
{% endblock content %} |
12 changes: 5 additions & 7 deletions
12
django-diary/source_code_final/entries/templates/entries/entry_detail.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
{% extends "entries/base.html" %} | ||
|
||
{% block content %} | ||
<article> | ||
<h2>{{ entry.date_created|date:'Y-m-d H:i' }}</h2> | ||
<h3>{{ entry.title }}</h3> | ||
<p>{{ entry.content }}</p> | ||
</article> | ||
|
||
<p> | ||
<a href="{% url 'entry-update' entry.id %}">✍️ Edit</a> | ||
<a href="{% url 'entry-delete' entry.id %}">⛔ Delete</a> | ||
</p> | ||
{% endblock %} | ||
<p> | ||
<a href="{% url 'entry-update' entry.id %}">✍️ Edit</a> | ||
<a href="{% url 'entry-delete' entry.id %}">⛔ Delete</a> | ||
</p> | ||
{% endblock content %} |
9 changes: 5 additions & 4 deletions
9
django-diary/source_code_final/entries/templates/entries/entry_form.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
{% extends "entries/base.html" %} | ||
{% block content %} | ||
<form method="post">{% csrf_token %} | ||
<form method="post"> | ||
{% csrf_token %} | ||
{{ form.as_p }} | ||
<input type="submit" value="Save"> | ||
</form> | ||
{% if entry %} | ||
<a href="{% url 'entry-detail' entry.id %}"> | ||
<button>Cancel</button> | ||
<button>Cancel</button> | ||
</a> | ||
{% else %} | ||
<a href="{% url 'entry-list' %}"> | ||
<button>Cancel</button> | ||
<button>Cancel</button> | ||
</a> | ||
{% endif %} | ||
{% endblock %} | ||
{% endblock content %} |
31 changes: 15 additions & 16 deletions
31
django-diary/source_code_final/entries/templates/entries/entry_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
{% extends "entries/base.html" %} | ||
|
||
{% block content %} | ||
<article> | ||
<h2 class="mark">{% now "Y-m-d H:i" %}</em></h2> | ||
<a href="{% url 'entry-create' %}"><button>Add new entry</button></a> | ||
<h2 class="mark"> | ||
{% now "Y-m-d H:i" %}</em> | ||
</h2> | ||
<a href="{% url 'entry-create' %}"> | ||
<button>Add new entry</button> | ||
</a> | ||
</article> | ||
{% for entry in entry_list %} | ||
<article> | ||
<h2 class="{{ entry.date_created|date:'l' }}">{{ entry.date_created|date:'Y-m-d H:i' }}</h2> | ||
<h3> | ||
<a href="{% url 'entry-detail' entry.id %}">{{ entry.title }}</a> | ||
</h3> | ||
</article> | ||
{% for entry in entry_list %} | ||
<article> | ||
<h2 class="{{ entry.date_created|date:'l' }}"> | ||
{{ entry.date_created|date:'Y-m-d H:i' }} | ||
</h2> | ||
<h3> | ||
<a href="{% url 'entry-detail' entry.id %}"> | ||
{{ entry.title }} | ||
</a> | ||
</h3> | ||
</article> | ||
{% endfor %} | ||
{% endblock %} | ||
{% endfor %} | ||
{% endblock content %} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.