diff --git a/IAP-Website/blog/__pycache__/admin.cpython-39.pyc b/IAP-Website/blog/__pycache__/admin.cpython-39.pyc
index ac2aacf..363fe30 100644
Binary files a/IAP-Website/blog/__pycache__/admin.cpython-39.pyc and b/IAP-Website/blog/__pycache__/admin.cpython-39.pyc differ
diff --git a/IAP-Website/blog/__pycache__/forms.cpython-39.pyc b/IAP-Website/blog/__pycache__/forms.cpython-39.pyc
index 4194a21..dda3f68 100644
Binary files a/IAP-Website/blog/__pycache__/forms.cpython-39.pyc and b/IAP-Website/blog/__pycache__/forms.cpython-39.pyc differ
diff --git a/IAP-Website/blog/__pycache__/models.cpython-39.pyc b/IAP-Website/blog/__pycache__/models.cpython-39.pyc
index c5666fe..14676b8 100644
Binary files a/IAP-Website/blog/__pycache__/models.cpython-39.pyc and b/IAP-Website/blog/__pycache__/models.cpython-39.pyc differ
diff --git a/IAP-Website/blog/__pycache__/urls.cpython-39.pyc b/IAP-Website/blog/__pycache__/urls.cpython-39.pyc
index 27c184c..1efb14f 100644
Binary files a/IAP-Website/blog/__pycache__/urls.cpython-39.pyc and b/IAP-Website/blog/__pycache__/urls.cpython-39.pyc differ
diff --git a/IAP-Website/blog/__pycache__/views.cpython-39.pyc b/IAP-Website/blog/__pycache__/views.cpython-39.pyc
index ce040e4..6919d07 100644
Binary files a/IAP-Website/blog/__pycache__/views.cpython-39.pyc and b/IAP-Website/blog/__pycache__/views.cpython-39.pyc differ
diff --git a/IAP-Website/blog/admin.py b/IAP-Website/blog/admin.py
index 5e1c392..0b25676 100644
--- a/IAP-Website/blog/admin.py
+++ b/IAP-Website/blog/admin.py
@@ -1,5 +1,15 @@
from django.contrib import admin
-from .models import Post
+from blog.models import Post, Comment
-# Register your models here.
+class BlogAdminArea(admin.AdminSite):
+ site_header = "IAP Blog Admin Area"
+
+blog_site = BlogAdminArea(name="BlogAdmin")
+blog_site.register(Post)
+#blog_site.register(Post)
admin.site.register(Post)
+
+
+# Register your models here.
+#admin.site.register(Post)
+#blog_site.register(models.Post)
diff --git a/IAP-Website/blog/forms.py b/IAP-Website/blog/forms.py
index e1de38d..90fcab3 100644
--- a/IAP-Website/blog/forms.py
+++ b/IAP-Website/blog/forms.py
@@ -2,8 +2,14 @@
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from django import forms
+from .models import Comment
class CreateUserForm(UserCreationForm):
class Meta:
model = User
- fields = ['username', 'email', 'password1', 'password2']
\ No newline at end of file
+ fields = ['username', 'email', 'password1', 'password2']
+
+class CommentForm(forms.ModelForm):
+ class Meta:
+ model = Comment
+ fields = ('name', 'email','body')
\ No newline at end of file
diff --git a/IAP-Website/blog/migrations/0003_alter_post_body_alter_post_current_time.py b/IAP-Website/blog/migrations/0003_alter_post_body_alter_post_current_time.py
new file mode 100644
index 0000000..fa0742f
--- /dev/null
+++ b/IAP-Website/blog/migrations/0003_alter_post_body_alter_post_current_time.py
@@ -0,0 +1,23 @@
+# Generated by Django 4.2.6 on 2023-10-30 04:38
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0002_post_current_time'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='post',
+ name='body',
+ field=models.TextField(),
+ ),
+ migrations.AlterField(
+ model_name='post',
+ name='current_time',
+ field=models.DateTimeField(auto_now_add=True),
+ ),
+ ]
diff --git a/IAP-Website/blog/migrations/0004_alter_post_options.py b/IAP-Website/blog/migrations/0004_alter_post_options.py
new file mode 100644
index 0000000..2858d6e
--- /dev/null
+++ b/IAP-Website/blog/migrations/0004_alter_post_options.py
@@ -0,0 +1,17 @@
+# Generated by Django 4.2.6 on 2023-10-30 10:18
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0003_alter_post_body_alter_post_current_time'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='post',
+ options={'ordering': ('-current_time',)},
+ ),
+ ]
diff --git a/IAP-Website/blog/migrations/0005_post_slug_comment.py b/IAP-Website/blog/migrations/0005_post_slug_comment.py
new file mode 100644
index 0000000..4975d04
--- /dev/null
+++ b/IAP-Website/blog/migrations/0005_post_slug_comment.py
@@ -0,0 +1,31 @@
+# Generated by Django 4.2.6 on 2023-10-31 06:03
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0004_alter_post_options'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='post',
+ name='slug',
+ field=models.SlugField(default=1),
+ preserve_default=False,
+ ),
+ migrations.CreateModel(
+ name='Comment',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('name', models.CharField(max_length=220)),
+ ('current_time', models.DateTimeField(auto_now_add=True)),
+ ('email', models.EmailField(max_length=254)),
+ ('body', models.TextField()),
+ ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='blog.post')),
+ ],
+ ),
+ ]
diff --git a/IAP-Website/blog/migrations/0006_post_image.py b/IAP-Website/blog/migrations/0006_post_image.py
new file mode 100644
index 0000000..cb6d6e6
--- /dev/null
+++ b/IAP-Website/blog/migrations/0006_post_image.py
@@ -0,0 +1,18 @@
+# Generated by Django 4.2.6 on 2023-11-03 11:43
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0005_post_slug_comment'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='post',
+ name='image',
+ field=models.ImageField(blank=True, null=True, upload_to='uploaded/galleries'),
+ ),
+ ]
diff --git a/IAP-Website/blog/migrations/0007_alter_comment_options.py b/IAP-Website/blog/migrations/0007_alter_comment_options.py
new file mode 100644
index 0000000..918d8e2
--- /dev/null
+++ b/IAP-Website/blog/migrations/0007_alter_comment_options.py
@@ -0,0 +1,17 @@
+# Generated by Django 4.2.6 on 2023-12-09 17:14
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('blog', '0006_post_image'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='comment',
+ options={'ordering': ('-current_time',)},
+ ),
+ ]
diff --git a/IAP-Website/blog/migrations/__pycache__/0003_alter_post_body_alter_post_current_time.cpython-39.pyc b/IAP-Website/blog/migrations/__pycache__/0003_alter_post_body_alter_post_current_time.cpython-39.pyc
new file mode 100644
index 0000000..d5d0b5d
Binary files /dev/null and b/IAP-Website/blog/migrations/__pycache__/0003_alter_post_body_alter_post_current_time.cpython-39.pyc differ
diff --git a/IAP-Website/blog/migrations/__pycache__/0004_alter_post_options.cpython-39.pyc b/IAP-Website/blog/migrations/__pycache__/0004_alter_post_options.cpython-39.pyc
new file mode 100644
index 0000000..1c37a6e
Binary files /dev/null and b/IAP-Website/blog/migrations/__pycache__/0004_alter_post_options.cpython-39.pyc differ
diff --git a/IAP-Website/blog/migrations/__pycache__/0005_post_slug_comment.cpython-39.pyc b/IAP-Website/blog/migrations/__pycache__/0005_post_slug_comment.cpython-39.pyc
new file mode 100644
index 0000000..3dc98e2
Binary files /dev/null and b/IAP-Website/blog/migrations/__pycache__/0005_post_slug_comment.cpython-39.pyc differ
diff --git a/IAP-Website/blog/migrations/__pycache__/0006_post_image.cpython-39.pyc b/IAP-Website/blog/migrations/__pycache__/0006_post_image.cpython-39.pyc
new file mode 100644
index 0000000..c57338d
Binary files /dev/null and b/IAP-Website/blog/migrations/__pycache__/0006_post_image.cpython-39.pyc differ
diff --git a/IAP-Website/blog/migrations/__pycache__/0007_alter_comment_options.cpython-39.pyc b/IAP-Website/blog/migrations/__pycache__/0007_alter_comment_options.cpython-39.pyc
new file mode 100644
index 0000000..56ad029
Binary files /dev/null and b/IAP-Website/blog/migrations/__pycache__/0007_alter_comment_options.cpython-39.pyc differ
diff --git a/IAP-Website/blog/models.py b/IAP-Website/blog/models.py
index 3653ddf..ea2eb2f 100644
--- a/IAP-Website/blog/models.py
+++ b/IAP-Website/blog/models.py
@@ -4,9 +4,24 @@
import datetime
class Post(models.Model):
- title = models.CharField(max_length=20)
- current_time = models.DateTimeField(default=timezone.now, blank=True)
- body = models.CharField(max_length=1000000)
+ title = models.CharField(max_length=100)
+ current_time = models.DateTimeField(auto_now_add=True)
+ slug = models.SlugField()
+ image = models.ImageField(upload_to='uploaded/galleries', blank=True, null=True)
+ body = models.TextField()
+
+ class Meta:
+ ordering = ('-current_time',)
+
+class Comment(models.Model):
+ post = models.ForeignKey(Post, related_name="comments", on_delete=models.CASCADE)
+ name = models.CharField(max_length=220)
+ current_time = models.DateTimeField(auto_now_add=True)
+ email = models.EmailField()
+ body = models.TextField()
+
+ class Meta:
+ ordering = ('-current_time',)
# Create your models here.
diff --git a/IAP-Website/blog/templates/blog/base.html b/IAP-Website/blog/templates/blog/base.html
index cf1c248..eabf6a4 100644
--- a/IAP-Website/blog/templates/blog/base.html
+++ b/IAP-Website/blog/templates/blog/base.html
@@ -5,7 +5,6 @@
{%block content_area %}
-
Learning To code is so sweet
{% endblock %}
diff --git a/IAP-Website/blog/templates/blog/blog.html b/IAP-Website/blog/templates/blog/blog.html
index a01276e..8934394 100644
--- a/IAP-Website/blog/templates/blog/blog.html
+++ b/IAP-Website/blog/templates/blog/blog.html
@@ -6,63 +6,68 @@
-
-
- The Rural Cooking Blog
-
- July 23, 2023 | comments
- Lorem ipsum dolor sit amet consectetur adipisicing elit. In, nisi! Reprehenderit tenetur sunt voluptas accusamus est cupiditate totam cumque? Cumque amet aliquid repellendus quidem repellat possimus quibusdam repudiandae nisi omnis?
-
- Read More
-
-
-
+
+ {% for posts in post %}
+
-
Finding Solution
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Explicabo officia porro dicta, ex deserunt distinctio enim earum voluptates nostrum laborum error eaque quae alias asperiores. Inventore quo excepturi ullam officiis!
+
{{posts.current_time|timesince}} ago
+
{{posts.title|upper}}
+
{{posts.body|truncatewords:20}}
-
Continue Reading
+
Continue Reading
-
September 9, | Comment
+
-
+
+ {%endfor%}
+
+
+
+
-
-
-
Finding Solution
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Explicabo officia porro dicta, ex deserunt distinctio enim earum voluptates nostrum laborum error eaque quae alias asperiores. Inventore quo excepturi ullam officiis!
-
-
Continue Reading
-
-
-
-
-
September 9, | Comment
-
-
-
-
-
-
-
-
Finding Solution
-
Lorem ipsum dolor sit amet consectetur adipisicing elit. Explicabo officia porro dicta, ex deserunt distinctio enim earum voluptates nostrum laborum error eaque quae alias asperiores. Inventore quo excepturi ullam officiis!
-
-
Continue Reading
-
+
-
-
-
September 9, | Comment
-
+
-
+
@@ -85,23 +90,11 @@
Another heading in recent
Heading Again
-
-
-
Heading Again2
-
-
-
-
-
-
-
Heading Again2
-
-
-
- Learning To code is so sweet
+
+
{% endblock %}
diff --git a/IAP-Website/blog/templates/blog/details.html b/IAP-Website/blog/templates/blog/details.html
new file mode 100644
index 0000000..e7397c5
--- /dev/null
+++ b/IAP-Website/blog/templates/blog/details.html
@@ -0,0 +1,60 @@
+{% extends 'blog/base.html' %}
+{% load static %}
+
+
+{% block content_area %}
+
+
+
+
+
{{post.current_time|timesince}} ago
+
{{post.body|truncatewords:20}}
+
+
+
+
+
+
+
+
+
+
+
+
+ {% for Comment in post.comments.all %}
+
+
+
+
+
+
+
+
+
+
+
+ {% endfor %}
+
+
+{%endblock%}
+
+
+
+
diff --git a/IAP-Website/blog/templates/blog/footer.html b/IAP-Website/blog/templates/blog/footer.html
index ad12dd1..d34a837 100644
--- a/IAP-Website/blog/templates/blog/footer.html
+++ b/IAP-Website/blog/templates/blog/footer.html
@@ -1,7 +1,8 @@
{%load static %}
- The Rural Cooking Blog
- Copyright 2023
+
+ Copyright © The Rural Cooking Blog Developed by Novaweb & Jetro Web Development
+
{{Comment.name }}
{{ Comment.current_time |timesince }} ago+
{{Comment.body}}
+