-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
124 additions
and
19 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Generated by Django 4.2.13 on 2024-05-10 13:04 | ||
|
||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('nba_app', '0002_post'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Comment', | ||
fields=[ | ||
('comment_id', models.AutoField(primary_key=True, serialize=False)), | ||
('content', models.TextField(max_length=300)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='nba_app.post')), | ||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), | ||
], | ||
), | ||
] |
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
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,16 @@ | ||
<!-- comment.html --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Comment</title> | ||
</head> | ||
<body> | ||
<h1>Comment on Post {{ post_id }}</h1> | ||
<form action="{% url 'create_comment' post_id %}" method="post"> | ||
{% csrf_token %} | ||
<textarea name="content" placeholder="Write your comment..."></textarea><br> | ||
<button type="submit">Comment</button> | ||
</form> | ||
</body> | ||
</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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- post_detail.html --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Post Detail</title> | ||
</head> | ||
<body> | ||
<h1>Post Detail</h1> | ||
<p>{{ post.content }}</p> | ||
<h2>Comments</h2> | ||
<ul> | ||
{% for comment in comments %} | ||
<li>{{ comment.user.username }}: {{ comment.content }}</li> | ||
{% empty %} | ||
<li>No comments yet.</li> | ||
{% endfor %} | ||
</ul> | ||
<h3>Add a Comment</h3> | ||
<form action="{% url 'create_comment' post.post_id %}" method="post"> | ||
{% csrf_token %} | ||
<textarea name="content" placeholder="Write your comment..."></textarea><br> | ||
<button type="submit">Comment</button> | ||
</form> | ||
</body> | ||
</html> |