From 42c64ff514f05c0d3ff93872736725450f7d4633 Mon Sep 17 00:00:00 2001 From: "Chukwuebuka J.O" <53452638+happyjosh-tech@users.noreply.github.com> Date: Mon, 8 Jun 2020 20:50:57 -0700 Subject: [PATCH 1/3] This is the Blog Application for ZOIT Emergency accident response project --- src/mysite/blog/__init__.py | 0 src/mysite/blog/admin.py | 22 ++++ src/mysite/blog/apps.py | 5 + src/mysite/blog/forms.py | 8 ++ src/mysite/blog/migrations/0001_initial.py | 33 +++++ src/mysite/blog/migrations/0002_comment.py | 29 +++++ src/mysite/blog/migrations/__init__.py | 0 src/mysite/blog/models.py | 39 ++++++ src/mysite/blog/tests.py | 3 + src/mysite/blog/urls.py | 9 ++ src/mysite/blog/views.py | 50 +++++++ src/mysite/db.sqlite3 | Bin 0 -> 155648 bytes src/mysite/manage.py | 21 +++ src/mysite/mysite/__init__.py | 0 src/mysite/mysite/asgi.py | 16 +++ src/mysite/mysite/settings.py | 123 ++++++++++++++++++ src/mysite/mysite/urls.py | 22 ++++ src/mysite/mysite/wsgi.py | 16 +++ src/mysite/templates/base.html | 104 +++++++++++++++ src/mysite/templates/index.html | 74 +++++++++++ src/mysite/templates/post_details.html | 16 +++ src/mysite/templates/sidebar.html | 22 ++++ src/mysite/templates/views.html | 50 +++++++ .../migrations/0008_auto_20200608_1958.py | 18 +++ 24 files changed, 680 insertions(+) create mode 100644 src/mysite/blog/__init__.py create mode 100644 src/mysite/blog/admin.py create mode 100644 src/mysite/blog/apps.py create mode 100644 src/mysite/blog/forms.py create mode 100644 src/mysite/blog/migrations/0001_initial.py create mode 100644 src/mysite/blog/migrations/0002_comment.py create mode 100644 src/mysite/blog/migrations/__init__.py create mode 100644 src/mysite/blog/models.py create mode 100644 src/mysite/blog/tests.py create mode 100644 src/mysite/blog/urls.py create mode 100644 src/mysite/blog/views.py create mode 100644 src/mysite/db.sqlite3 create mode 100644 src/mysite/manage.py create mode 100644 src/mysite/mysite/__init__.py create mode 100644 src/mysite/mysite/asgi.py create mode 100644 src/mysite/mysite/settings.py create mode 100644 src/mysite/mysite/urls.py create mode 100644 src/mysite/mysite/wsgi.py create mode 100644 src/mysite/templates/base.html create mode 100644 src/mysite/templates/index.html create mode 100644 src/mysite/templates/post_details.html create mode 100644 src/mysite/templates/sidebar.html create mode 100644 src/mysite/templates/views.html create mode 100644 src/usersapp/migrations/0008_auto_20200608_1958.py diff --git a/src/mysite/blog/__init__.py b/src/mysite/blog/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/mysite/blog/admin.py b/src/mysite/blog/admin.py new file mode 100644 index 0000000..cda4327 --- /dev/null +++ b/src/mysite/blog/admin.py @@ -0,0 +1,22 @@ +from django.contrib import admin +from .models import Post, Comment + +class PostAdmin(admin.ModelAdmin): + list_display = ('title', 'slug', 'status','created_on') + list_filter = ("status",) + search_fields = ['title', 'content'] + prepopulated_fields = {'slug': ('title',)} + + +admin.site.register(Post, PostAdmin) + +@admin.register(Comment) +class CommentAdmin(admin.ModelAdmin): + list_display = ('name', 'body', 'post', 'created_on', 'active') + list_filter = ('active', 'created_on') + search_fields = ('name', 'email', 'body') + actions = ['approve_comments'] + + def approve_comments(self, request, queryset): + queryset.update(active=True) +# Register your models here. diff --git a/src/mysite/blog/apps.py b/src/mysite/blog/apps.py new file mode 100644 index 0000000..7930587 --- /dev/null +++ b/src/mysite/blog/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class BlogConfig(AppConfig): + name = 'blog' diff --git a/src/mysite/blog/forms.py b/src/mysite/blog/forms.py new file mode 100644 index 0000000..b7e7704 --- /dev/null +++ b/src/mysite/blog/forms.py @@ -0,0 +1,8 @@ +from .models import Comment +from django import forms + + +class CommentForm(forms.ModelForm): + class Meta: + model = Comment + fields = ('name', 'email', 'body') diff --git a/src/mysite/blog/migrations/0001_initial.py b/src/mysite/blog/migrations/0001_initial.py new file mode 100644 index 0000000..2ae2392 --- /dev/null +++ b/src/mysite/blog/migrations/0001_initial.py @@ -0,0 +1,33 @@ +# Generated by Django 3.0.6 on 2020-05-27 00:42 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Post', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200, unique=True)), + ('slug', models.SlugField(max_length=200, unique=True)), + ('updated_on', models.DateTimeField(auto_now=True)), + ('content', models.TextField()), + ('created_on', models.DateTimeField(auto_now_add=True)), + ('status', models.IntegerField(choices=[(0, 'Draft'), (1, 'Publish')], default=0)), + ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='blog_posts', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-created_on'], + }, + ), + ] diff --git a/src/mysite/blog/migrations/0002_comment.py b/src/mysite/blog/migrations/0002_comment.py new file mode 100644 index 0000000..1e6c647 --- /dev/null +++ b/src/mysite/blog/migrations/0002_comment.py @@ -0,0 +1,29 @@ +# Generated by Django 3.0.6 on 2020-05-27 15:33 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('blog', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Comment', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=80)), + ('email', models.EmailField(max_length=254)), + ('body', models.TextField()), + ('created_on', models.DateTimeField(auto_now_add=True)), + ('active', models.BooleanField(default=False)), + ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='blog.Post')), + ], + options={ + 'ordering': ['created_on'], + }, + ), + ] diff --git a/src/mysite/blog/migrations/__init__.py b/src/mysite/blog/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/mysite/blog/models.py b/src/mysite/blog/models.py new file mode 100644 index 0000000..fb02876 --- /dev/null +++ b/src/mysite/blog/models.py @@ -0,0 +1,39 @@ +from django.db import models +from django.contrib.auth.models import User + + +STATUS = ( + (0,"Draft"), + (1,"Publish") +) + +class Post(models.Model): + title = models.CharField(max_length=200, unique=True) + slug = models.SlugField(max_length=200, unique=True) + author = models.ForeignKey(User, on_delete= models.CASCADE,related_name='blog_posts') + updated_on = models.DateTimeField(auto_now= True) + content = models.TextField() + created_on = models.DateTimeField(auto_now_add=True) + status = models.IntegerField(choices=STATUS, default=0) + + class Meta: + ordering = ['-created_on'] + + def __str__(self): + return self.title + +class Comment(models.Model): + post = models.ForeignKey(Post,on_delete=models.CASCADE,related_name='comments') + name = models.CharField(max_length=80) + email = models.EmailField() + body = models.TextField() + created_on = models.DateTimeField(auto_now_add=True) + active = models.BooleanField(default=False) + + class Meta: + ordering = ['created_on'] + + def __str__(self): + return 'Comment {} by {}'.format(self.body, self.name) + +# Create your models here. diff --git a/src/mysite/blog/tests.py b/src/mysite/blog/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/src/mysite/blog/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/src/mysite/blog/urls.py b/src/mysite/blog/urls.py new file mode 100644 index 0000000..d3777f8 --- /dev/null +++ b/src/mysite/blog/urls.py @@ -0,0 +1,9 @@ +from . import views +from django.urls import path + +urlpatterns = [ + path('', views.PostList.as_view(), name='home'), + path('/', views.PostDetail.as_view(), name='post_detail'), + path('/', views.post_detail, name='post_detail') + +] diff --git a/src/mysite/blog/views.py b/src/mysite/blog/views.py new file mode 100644 index 0000000..9afd8c0 --- /dev/null +++ b/src/mysite/blog/views.py @@ -0,0 +1,50 @@ +from django.views import generic +from .models import Post +from .forms import CommentForm +from django.shortcuts import render, get_object_or_404 + +class PostList(generic.ListView): + queryset = Post.objects.filter(status=1).order_by('-created_on') + template_name = 'index.html' + +class PostDetail(generic.DetailView): + model = Post + template_name = 'post_detail.html' +class PostList(generic.ListView): + queryset = Post.objects.filter(status=1).order_by('-created_on') + template_name = 'index.html' + paginate_by = 3 + +class PostList(generic.ListView): + queryset = Post.objects.filter(status=1).order_by('-created_on') + template_name = 'index.html' + +class PostDetail(generic.DetailView): + model = Post + template_name = 'post_detail.html' +def post_detail(request, slug): + template_name = 'post_detail.html' + post = get_object_or_404(Post, slug=slug) + comments = post.comments.filter(active=True) + new_comment = None + # Comment posted + if request.method == 'POST': + comment_form = CommentForm(data=request.POST) + if comment_form.is_valid(): + + # Create Comment object but don't save to database yet + new_comment = comment_form.save(commit=False) + # Assign the current post to the comment + new_comment.post = post + # Save the comment to the database + new_comment.save() + else: + comment_form = CommentForm() + + return render(request, template_name, {'post': post, + 'comments': comments, + 'new_comment': new_comment, + 'comment_form': comment_form}) + + +# Create your views here. diff --git a/src/mysite/db.sqlite3 b/src/mysite/db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..02f0905a412cd8d0507a1edb209afec8c1e9a7eb GIT binary patch literal 155648 zcmeI5eQXENkn}XnSxgzlYJpAu`R$#}|Ie@>MV}I0c#I+a`ywsR{kJ^OD_X5)se>rh};y3+Y z_kGv@kHbk>-zmsj*c4M{=x}gXnTQc8(OWXK2%!Ga;{~lja;dr zx9WzuuNBS19PFfH(YRO;3%OQJd(dxw^748%vyl~UudUp?ofTHru4L~D;eM+_oQ8!P zYlDfx!i6vsrWL~%g)ox`dcu+R(s5s?l;+xsT>>+pp%Y-2=`J zliW!FYVVWrP@7M4`)7|Nx2Lc6nMLLz8Tp(V8;tliiU)^1?CK3@kvmGGP*xfjBsmr7HcMzE z6~$=gDtbw)g@vNhRGV5=b;fH(&S*iypp7&v}-VM2IX${C` zv}H%gffj02(JFRM$+(>pq^Clg%GTDPNQhAiO>GBM_Uor5&fV9wnhJ;piXV}VjfJu^ zoQqu!jRzHYT+2a4fjvCm&^_w`N9yiQ?5~acLg_U3IBD0f*_Q0H%RDg#Lj6N(e!%F7 znt|!%hu)Zhx?L#x0QFg1W7<<=zR>I}*WT^}%9yi~`9^_zB3Qj`Fg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bIn#nI}p|m?f#V5R0Qv(gM7qKQo(&!bPCdXu2=tFUZbxowxSoL@E{+p&7SWS=l^-~3H|=R|4shK^L(ktvLgW`fCP{L5x?DH?g@UnJB(rW|37w-kI5gAzj&I!UjJ`00|%gB!C2v01`j~NB{{S z0VIF~kiZiYc*i~NdMP=Z@pJce1HRou-`-W|UZq)lvs6{I$|8Jq!g2$?X+o%}yN2Us zeJQadCzj%=#Z)vdMN|B{9Q7m}?1_CH0Cgn5cLHp|cOhJKdW + + + ZOIT NEWSROOM + + + + + + + + + + + + + + + + {% block content %} + + + {% endblock content %} + + +
+

Copyright © Django Central

+
+ + + diff --git a/src/mysite/templates/index.html b/src/mysite/templates/index.html new file mode 100644 index 0000000..80932b4 --- /dev/null +++ b/src/mysite/templates/index.html @@ -0,0 +1,74 @@ +{% extends "base.html" %} + + {% block content %} + + +
+
+
+
+
+
+

Welcome to my awesome Blog

+

We Love YOU As much as you do..!   +

+
+
+
+
+ +
+ +
+
+ + +
+ {% for post in post_list %} +
+
+

{{ post.title }}

+

{{ post.author }} | {{ post.created_on}}

+ +

{{post.content|slice:":200" }}

+ Read More → +
+ +
+ {% endfor %} +
+ {% block sidebar %} + {% include 'sidebar.html' %} + {% endblock sidebar %} +
+
+{%endblock%} + +{% if is_paginated %} + +
    + {% if page_obj.has_previous %} +
  • « PREV
  • + {% endif %} + {% if page_obj.has_next %} +
  • NEXT »
  • + + {% endif %} +
+ + +{% endif %} diff --git a/src/mysite/templates/post_details.html b/src/mysite/templates/post_details.html new file mode 100644 index 0000000..2e9eeed --- /dev/null +++ b/src/mysite/templates/post_details.html @@ -0,0 +1,16 @@ +{% extends 'base.html' %} {% block content %} + +
+
+
+
+

{% block title %} {{ object.title }} {% endblock title %}

+

{{ post.author }} | {{ post.created_on }}

+

{{ object.content | safe }}

+
+
+ {% block sidebar %} {% include 'sidebar.html' %} {% endblock sidebar %} +
+
+ +{% endblock content %} diff --git a/src/mysite/templates/sidebar.html b/src/mysite/templates/sidebar.html new file mode 100644 index 0000000..cfb5b36 --- /dev/null +++ b/src/mysite/templates/sidebar.html @@ -0,0 +1,22 @@ +{% block sidebar %} + + + + +
+
+
About Us
+
+

This awesome blog is made on the top of our Favourite full stack Framework 'Django', follow up the tutorial to learn how we made it..!

+ Know more! +
+
+
+ +{% endblock sidebar %} diff --git a/src/mysite/templates/views.html b/src/mysite/templates/views.html new file mode 100644 index 0000000..cd34f50 --- /dev/null +++ b/src/mysite/templates/views.html @@ -0,0 +1,50 @@ +{% extends 'base.html' %} {% block content %} + +
+
+
+
+

{% block title %} {{ post.title }} {% endblock title %}

+

{{ post.author }} | {{ post.created_on }}

+

{{ post.content | safe }}

+
+
+ {% block sidebar %} {% include 'sidebar.html' %} {% endblock sidebar %} + +
+
+ +

{{ comments.count }} comments

+ + {% for comment in comments %} +
+

+ {{ comment.name }} + + {{ comment.created_on }} + +

+ {{ comment.body | linebreaks }} +
+ {% endfor %} +
+
+
+
+ {% if new_comment %} + + {% else %} +

Leave a comment

+
+ {{ comment_form.as_p }} + {% csrf_token %} + +
+ {% endif %} +
+
+
+
+{% endblock content %} diff --git a/src/usersapp/migrations/0008_auto_20200608_1958.py b/src/usersapp/migrations/0008_auto_20200608_1958.py new file mode 100644 index 0000000..b551f88 --- /dev/null +++ b/src/usersapp/migrations/0008_auto_20200608_1958.py @@ -0,0 +1,18 @@ +# Generated by Django 3.0.6 on 2020-06-09 02:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('usersapp', '0007_auto_20200601_2102'), + ] + + operations = [ + migrations.AlterField( + model_name='incident', + name='accident_location', + field=models.CharField(choices=[('FCT', 'FCT'), ('Abia', 'Abia'), ('Adamawa', 'Adamawa'), ('Akwa Ibom', 'Akwa Ibom'), ('Anambra', 'Anambra'), ('Bauchi', 'Bauchi'), ('Bayelsa', 'Bayelsa'), ('Benue', 'Benue'), ('Borno', 'Borno'), ('Cross River', 'Cross River'), ('Delta', 'Delta'), ('Ebonyi', 'Ebonyi'), ('Enugu', 'Enugu'), ('Edo', 'Edo'), ('Ekiti', 'Ekiti'), ('Gombe', 'Gombe'), ('Imo', 'Imo'), ('Jigawa', 'Jigawa'), ('Kaduna', 'Kaduna'), ('Kano', 'Kano'), ('Katsina', 'Katsina'), ('Kebbi', 'Kebbi'), ('Kogi', 'Kogi'), ('Kwara', 'Kwara'), ('Lagos', 'Lagos'), ('Nasarawa', 'Nasarawa'), ('Niger', 'Niger'), ('Ogun', 'Ogun'), ('Ondo', 'Ondo'), ('Osun', 'Osun'), ('Oyo', 'Oyo'), ('Plateau', 'Plateau'), ('Rivers', 'Rivers'), ('Sokoto', 'Sokoto'), ('Taraba', 'Taraba'), ('Yobe', 'Yobe'), ('Zamfara', 'Zamfara')], max_length=45), + ), + ] From 02a7e105539d6124a38db129d58a35e215783943 Mon Sep 17 00:00:00 2001 From: "Chukwuebuka J.O" <53452638+happyjosh-tech@users.noreply.github.com> Date: Tue, 9 Jun 2020 01:32:58 -0700 Subject: [PATCH 2/3] Readme --- src/mysite/Readme.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/mysite/Readme.txt diff --git a/src/mysite/Readme.txt b/src/mysite/Readme.txt new file mode 100644 index 0000000..cd9c071 --- /dev/null +++ b/src/mysite/Readme.txt @@ -0,0 +1,14 @@ +## Description +This Pull Request contains the Blog application for ZOIT Emergency Accident Response project. Since one of the objective of the project is to make a social website where users can interact, post and read present and past accident information nearest and distant from them. The blog shall be updated everyday by an admin who shall gather accident complaints from accident victims and eyewitness report to validate, post and update the general public. +The application was built with Django full stack with all the dependencies installed. +get the Readme file of the src folder to get instructions on how to clone and install dependencies and libraries for the repository. +This pull request is related to issue number #18 + +## How Has This Been Tested? +1. First locate the application directory on the Team-102-GoodHealthAndWellBeing repo by: +cd Team-102-GoodHealthAndWellBeing +cd src +cd mysite +2. create your own virtual env or try 'workon zoitblog' +3 Create superuser in other to access the admin +4. Run server with python manage.py runserver From cc9653fb794284f0cf1668eaaf52a24081814842 Mon Sep 17 00:00:00 2001 From: "Chukwuebuka J.O" <53452638+happyjosh-tech@users.noreply.github.com> Date: Tue, 9 Jun 2020 08:01:55 -0700 Subject: [PATCH 3/3] mysite --- src/mysite/db.sqlite3 | Bin 155648 -> 155648 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/mysite/db.sqlite3 b/src/mysite/db.sqlite3 index 02f0905a412cd8d0507a1edb209afec8c1e9a7eb..8e9c480c3287e6cddef270dbbdd2ad422903ce4e 100644 GIT binary patch delta 254 zcmZoTz}awsbAmLZ&O{k!MxBibOX4}0cv~3w4)L~ZR#d3q)o8M2V)bodbu=(C%g#%y zD$6Y?&rd8(EJ`#pHmk_UNHxkeHZ(3MHr)IwkA+dn$XLO^!phjx%FtNP+|bzE!lKEV z5v+gmgL(y^8YxB&CjRXV{M-5OY!)n7&9AD$?8`{VY^Ke3>hH*lnCTi=B8)e&G&L}` yY(6u8`RyT;y(;Dc00ek9J3>%k%5tcu7Q~@rlXj)Kl;xomjD2{x=ddH delta 116 zcmZoTz}awsbAmLZ=0q81M$L^0OXArW`3^Dg9onp@u!E1I$(oVXw}sVl@`HMX&9CyL z7&#dE?=S!n`)0w03;dh!)ZdX8G1WCPS1>TJGBL3-vD7m(H?lM`Zay=A`