Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
65f0e30
first
Aug 25, 2024
d485718
first
Aug 25, 2024
ef4cf99
ckeditor added
Aug 26, 2024
eef0634
new theme
Aug 26, 2024
04afcd3
0
tej589 Sep 1, 2024
daac6fe
gitignore added
Oct 26, 2024
1fcbba8
fixed requirements
Oct 26, 2024
d87bb95
removing cache
Nov 1, 2024
5f27854
fixed requirements
Nov 1, 2024
5157593
updating readme
Nov 1, 2024
a29e529
updating readme
Nov 1, 2024
33ce4ef
updating readme
Nov 1, 2024
74da225
some changes
Nov 9, 2024
8e4164a
some to do s
Nov 9, 2024
caf47e6
Ajout
hajriislem01 Nov 13, 2024
b8c53f4
admin_change
hajriislem01 Nov 14, 2024
49bdacb
modif 1.0
hajriislem01 Nov 15, 2024
1bcb53d
modif_1.1
hajriislem01 Nov 15, 2024
ae81499
modif_1.2
hajriislem01 Nov 16, 2024
be864f9
to prod
Nov 16, 2024
1bc6b80
added dockerfile
Nov 16, 2024
33dc81d
adding gunicorn
Nov 16, 2024
28d9ae6
prod deployment
Nov 16, 2024
fb6317b
working on prod
Nov 18, 2024
db50ac3
env var config
Nov 18, 2024
63bea5e
testing
Nov 18, 2024
a8b98b4
merging env var
Nov 18, 2024
e86ce50
fixing home
Nov 18, 2024
328ef13
removing db
Nov 18, 2024
5cda05e
fixing db
Nov 18, 2024
7468a0d
delete db from git
Nov 18, 2024
b38c2c4
merging env var
Nov 18, 2024
f75b0a2
adding all posts
Nov 19, 2024
b11d552
ajout_posts
hajriislem01 Nov 20, 2024
7226383
modif1.5
hajriislem01 Nov 22, 2024
4b0a039
modif1.5
hajriislem01 Nov 28, 2024
4117c04
comments, homepage & post-details UI
WeslatiWalid Nov 29, 2024
46549b1
modif1.6
hajriislem01 Nov 29, 2024
db96b30
ok
hajriislem01 Nov 29, 2024
492d393
add_comment
hajriislem01 Dec 19, 2024
b096733
add_profile
hajriislem01 Dec 23, 2024
3300218
adding Replys to Comments
WeslatiWalid Dec 23, 2024
c87b61d
merege
WeslatiWalid Dec 23, 2024
0ce6d6a
login
hajriislem01 Dec 24, 2024
1eee5a2
removing sqlite
Dec 24, 2024
7da7a59
profile
hajriislem01 Dec 24, 2024
84c5159
fixing reply & comments
WeslatiWalid Dec 25, 2024
b979c94
rm db
WeslatiWalid Dec 25, 2024
e0cd4c3
auteur_de_mois
hajriislem01 Dec 27, 2024
ed22940
sql remove
hajriislem01 Dec 27, 2024
fc3906d
Merge branch 'islem_branch' into fix_reply
mmby85 Dec 27, 2024
5d31ee5
Merge pull request #1 from mmby85/fix_reply
mmby85 Dec 27, 2024
36448e2
Merge pull request #2 from mmby85/islem_branch
mmby85 Dec 27, 2024
ddf3437
Merge remote-tracking branch 'origin/fix_reply'
Dec 27, 2024
4a32a12
fixed merged
Dec 27, 2024
7b2286c
change category
Dec 27, 2024
fd397d5
rm migrations
Dec 27, 2024
d11d4db
Merge branch 'main' of github.com:mmby85/bizz2goo
Dec 27, 2024
d4d28b1
images & author bugs
WeslatiWalid Feb 11, 2025
05a3189
latest updates
WeslatiWalid Feb 25, 2025
884709f
latest changes
WeslatiWalid Apr 4, 2025
e710782
UI & Typo updates
WeslatiWalid Apr 24, 2025
6672db6
UI Updates
WeslatiWalid Apr 28, 2025
1be9287
latest updates
WeslatiWalid May 12, 2025
688b2d9
Include static files
WeslatiWalid Jun 8, 2025
d392adc
Include static filess
WeslatiWalid Jun 8, 2025
354e493
Include static files and update .gitignore
WeslatiWalid Jun 8, 2025
6499b04
UI tweeks & adding email forms
WeslatiWalid Jun 20, 2025
84ba8fe
fix email settings
WeslatiWalid Jun 20, 2025
922e605
UI mobile Responsive Tweeks & adding newslettre functionality
WeslatiWalid Jul 3, 2025
dead46c
enable posts Date&Time editing
WeslatiWalid Jul 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add_comment
  • Loading branch information
hajriislem01 committed Dec 19, 2024
commit 492d393c65558a41ebdfc2ee56e4f3b71631f4af
Binary file modified db.sqlite3
Binary file not shown.
18 changes: 18 additions & 0 deletions myapp/migrations/0012_alter_post_time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.8 on 2024-12-12 13:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('myapp', '0011_alter_post_time'),
]

operations = [
migrations.AlterField(
model_name='post',
name='time',
field=models.CharField(blank=True, default='12 December 2024', max_length=100),
),
]
3 changes: 2 additions & 1 deletion myapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class Comment(models.Model):
time = models.DateTimeField(auto_now_add=True, blank=True)
post = models.ForeignKey(CKPost, related_name="comments", on_delete=models.CASCADE)
user = models.CharField(max_length=100)
to_field="slug",



def __str__(self):
return f"{self.id}.{self.content[:20]}..."
Expand Down
40 changes: 25 additions & 15 deletions myapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,50 +358,60 @@ def get_subcategories(request):



from django.shortcuts import get_object_or_404

@csrf_exempt
def add_comment(request):
if request.method == "POST":
# Extract data from the request
# Extraire les données
slug = request.POST.get("slug")
username = request.POST.get("username")
content = request.POST.get("content")
post_id = request.POST.get("post_id")

# Validate that required fields are provided
if not all([username, content, post_id]):
parent_id = request.POST.get("parent_id") # ID du commentaire parent (s'il existe)
# Vérification des champs requis
if not all([slug, username, content]):
return JsonResponse({"error": "Missing fields in the form."}, status=400)

# Vérifier l'existence du post
post = get_object_or_404(CKPost, slug=slug)

# Find the related post
post = get_object_or_404(CKPost, id=post_id)
# Récupérer le commentaire parent s'il existe
parent_comment = None
if parent_id:
parent_comment = get_object_or_404(Comment, id=parent_id)

# Create and save the comment
# Créer le commentaire
comment = Comment.objects.create(
user=username,
content=content,
post=post
post=post,

)

# Create the comment HTML (No escaping)
# Générer le HTML du commentaire (ou de la réponse)
comment_html = f"""
<div class="media p-3 border rounded mb-3 bg-white shadow-sm">
<a class="pull-left" href="#">
<div class="avatar">
<img src="/path/to/avatar.jpg" alt="{comment.user}" class="media-object" />
<img src="/static/assets/images/user.png" alt="{comment.user}" class="media-object" />
</div>
</a>
<div class="media-body">
<h5 class="media-heading">{comment.user}</h5>
<h6 class="text-muted">{comment.time.strftime('%B %d, %Y %I:%M %p')}</h6>
<p>{comment.content}</p>
<a href="#" class="btn-link pull-right btn btn-info">
<a href="#" class="btn-link pull-right btn btn-info reply-btn" data-comment-id="{comment.id}">
<i class="fa fa-reply mr-1"></i> Reply
</a>
</div>
</div>
"""

return HttpResponse(comment_html, content_type="text/html")
else:
return JsonResponse({"error": "Invalid request method."}, status=405)

return JsonResponse({"error": "Invalid request method."}, status=405)





Expand Down
117 changes: 62 additions & 55 deletions templates/blog/post-detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ <h4>{{ post.content | safe }}</h4>
</div>
</div>

<hr><br>


<!-- Author Profile -->
<div class="row" style="margin-left: 100px; margin-right: 100px;">
<hr><br>
<div class="media">
<a class="pull-left" href="{% url 'author_profile' author_profile.user.username %}">
<div class="avatar big-avatar">
Expand All @@ -69,65 +70,71 @@ <h4 class="media-heading" style="color: #403d39; display: inline-block; font-wei
{% endif %}
</div>
</div>
<hr><br>
</div>

<hr><br>


<!-- Comments Section -->
<div class="row">
<div class="comments media-area">
<h3 class="text-center">Comments</h3>
{% if not post.comments.all %}
<p>No comments yet ... <a href="#">Add one</a></p>
{% else %}
<div id="comments-container">
<!-- Display all comments -->
{% for comment in post.comments.all %}
<div class="media p-3 border rounded mb-3 bg-white shadow-sm">
<a class="pull-left" href="#">
<div class="avatar">
<img src="/path/to/avatar.jpg" alt="{{ comment.user }}" class="media-object" />
</div>
</a>
<div class="media-body">
<h5 class="media-heading">{{ comment.user }}</h5>
<h6 class="text-muted">{{ comment.time }}</h6>
<p>{{ comment.content }}</p>
<a href="#" class="btn-link pull-right btn btn-info">
<i class="fa fa-reply mr-1"></i> Reply
</a>
</div>
</div>
{% endfor %}
<!-- Placeholder for new comments -->
<div class="fake-comment-placeholder"></div>
</div>
{% endif %}
<div class="row"style="margin-left: 100px; margin-right: 100px;">
<div class="comments media-area">
<h3 class="text-center">Comments</h3>

<div id="comments-container">
<!-- Display all comments -->
{% for comment in post.comments.all %}
<div class="media p-3 border rounded mb-3 bg-white shadow-sm">
<a class="pull-left" href="#">
<div class="avatar">
<img src="\static\assets\images\user.png" alt="{{ comment.user }}" class="media-object" />
</div>
</a>
<div class="media-body">
<h5 class="media-heading">{{ comment.user }}</h5>
<div style="text-align: right;">
<h6 style="color: #6c757d;">{{ comment.time }}</h6>
<a href="#pablo" class="btn-link pull-right btn btn-info">
<i class="fa fa-reply mr-1">

</i>Reply</a>
</div>


<p>{{ comment.content }}</p>

</div>
</div>
{% endfor %}
<!-- Placeholder for new comments -->
<div class="fake-comment-placeholder"></div>
</div>


<!-- Add a New Comment Form -->
<form
method="POST"
action="{% url 'add_comment' %}"
hx-post="{% url 'add_comment' %}"
hx-target=".fake-comment-placeholder"
hx-swap="beforeend"
class="border p-4 rounded shadow-sm bg-light mt-4"
id="comment-form"
>
{% csrf_token %}
<div class="form-group mb-3">
<label for="username" class="form-label fw-bold">Your Name</label>
<input type="text" id="username" name="username" placeholder="Enter your name" required class="form-control">
</div>
<div class="form-group mb-3">
<label for="content" class="form-label fw-bold">Your Comment</label>
<textarea id="content" name="content" placeholder="Write your comment here..." required class="form-control"></textarea>
</div>
<input type="hidden" name="post_id" value="{{ post.id }}">
<button type="submit" class="btn btn-primary w-100">Add Comment</button>
</form>
</div>
</div>
<!-- Add a New Comment Form -->
<form
method="POST"
action="{% url 'add_comment' %}"
hx-post="{% url 'add_comment' %}"
hx-target=".fake-comment-placeholder"
hx-swap="beforeend"
class="border p-4 rounded shadow-sm bg-light mt-4"
id="comment-form"
>
{% csrf_token %}
<div class="form-group mb-3">
<label for="username" class="form-label fw-bold">Your Name</label>
<input type="text" id="username" name="username" placeholder="Enter your name" required class="form-control">
</div>
<div class="form-group mb-3">
<label for="content" class="form-label fw-bold">Your Comment</label>
<textarea id="content" name="content" placeholder="Write your comment here..." required class="form-control"></textarea>
</div>
<input type="hidden" name="slug" value="{{ post.slug }}">

<button type="submit" class="btn btn-primary w-100">Add Comment</button>
</form>
</div>
</div>

<!-- Related Articles -->
<div class="related-articles">
Expand Down