From bd6a414139f1107a48f826feb6b738cfabbf01f0 Mon Sep 17 00:00:00 2001 From: Anas-Mhameed Date: Wed, 4 Jan 2023 13:55:09 +0200 Subject: [PATCH 1/2] Adding read article feature, adding a new view, new template, new route --- finalProject_g4/urls.py | 5 +- projboard/static/css/read_article.css | 36 ++++++++ projboard/templates/base.html | 2 +- .../searchArticle/search_article.html | 2 +- projboard/templates/show/read_article.html | 59 ++++++++++++ projboard/tests/conftest.py | 12 +++ projboard/tests/test_client.py | 91 +++++++++++++++++-- projboard/views.py | 46 +++++++++- 8 files changed, 240 insertions(+), 13 deletions(-) create mode 100644 projboard/static/css/read_article.css create mode 100644 projboard/templates/show/read_article.html diff --git a/finalProject_g4/urls.py b/finalProject_g4/urls.py index 8680e7e..e8e499f 100644 --- a/finalProject_g4/urls.py +++ b/finalProject_g4/urls.py @@ -20,11 +20,12 @@ urlpatterns = [ path('admin/', admin.site.urls), path('', views.home_page, name='homepage'), - path('search/', views.search, name='search'), + path('search//', views.search, name='search'), path('create_article/', views.create_article, name='create_article'), path('about/', views.about_page, name='aboutpage'), path('my_articles//', views.my_articles, name="my_articles"), - path('signup/', views.sign_up, name='signup') + path('signup/', views.sign_up, name='signup'), + path('article///', views.show_article, name='show_article'), ] handler404 = views.error_404 diff --git a/projboard/static/css/read_article.css b/projboard/static/css/read_article.css new file mode 100644 index 0000000..d7e62c9 --- /dev/null +++ b/projboard/static/css/read_article.css @@ -0,0 +1,36 @@ + +article{ + max-width: 70%; + margin: 0 auto; + +} +header{ + min-height: 40vh; +} +.footer { + + display: flex; + justify-content: flex-end; + align-items: flex-end; + gap: 1rem; +} +.footer > *{ + margin : 0px 0px 0px; +} +hr { + border: 0; + height: 3px; + background-image: -webkit-linear-gradient(left, #5b5b5b, #3c3326, #f0f0f0); + background-image: -moz-linear-gradient(left, #5b5b5b, #3c3326, #f0f0f0); + background-image: -ms-linear-gradient(left, #5b5b5b, #3c3326, #f0f0f0); + background-image: -o-linear-gradient(left, #5b5b5b, #3c3326, #f0f0f0); +} +.nickname{ + justify-self: flex-start; +} +.Green{ + background-color: rgb(54, 169, 38); +} +.Red{ + background-color: rgb(186, 80, 80); +} \ No newline at end of file diff --git a/projboard/templates/base.html b/projboard/templates/base.html index d2a48a5..0cbdb5f 100644 --- a/projboard/templates/base.html +++ b/projboard/templates/base.html @@ -42,7 +42,7 @@ Create Article