Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# python_blog
A blogging website, meant to be used to share blog related to the Python programming language.
1. A superuser can upload blog and can attach certain related tags to each blog.
2. Any any visitor can view the list of blog, their author and times of creation.
3. Any authorized user can read a blog, comment on the blog or reply on any comment.
4. Each blog has an integrated discussion board automatically linked to it, for any comments.

The project has 3 apps:
1. articles
2. boards
3. accounts

**articles app:**
This app has the following models,
1. Article
2. Tag

This app handles the following functionalities:
1. Creates Article from the blog content and thumbnail.
2. Lets a superuser to create Tags and link these tags to their blog.
3. Contains all the views related to Article and Tag model.

**boards app:**
This app has the following models,
1. Board
2. Post

and handles the following functionalities:
1. Creates a discussion board for each Article.
2. Lets any user to write comment in the discussion board.
3. Lets any user to reply to an existing comment.

**accounts app:**
This app handles all the authentication and user creation related tasks.

**Future plans:**
To add profiles support for each user.
Binary file added accounts/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file added accounts/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file added articles/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added articles/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file added articles/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file added articles/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added articles/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 9 additions & 1 deletion articles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@


def home_view(request):

return render(request, 'home.html')


def articles_list_view(request) :
#list out objects all articles
all_articles = Article.objects.all()
return render(request, 'home.html', {'articles': all_articles})
template_name = 'article_list.html'
context = {"articles": all_articles}
return render(request, template_name, context)


def mod_articles(request):
Expand Down
Binary file added boards/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added boards/__pycache__/admin.cpython-37.pyc
Binary file not shown.
Binary file added boards/__pycache__/forms.cpython-37.pyc
Binary file not shown.
Binary file added boards/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file added boards/__pycache__/views.cpython-37.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions boards/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ def reply_view(request, id_):
return redirect(url)

return redirect('home_url')


def discussion_boards(request):
articles = models.Article.objects.all()
return render(request, 'discussion_boards.html', {'articles': articles })
Binary file modified db.sqlite3
Binary file not shown.
Binary file added python_blog/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
Binary file added python_blog/__pycache__/settings.cpython-37.pyc
Binary file not shown.
Binary file added python_blog/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file added python_blog/__pycache__/wsgi.cpython-37.pyc
Binary file not shown.
5 changes: 5 additions & 0 deletions python_blog/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,8 @@
# https://docs.djangoproject.com/en/2.2/howto/static-files/

STATIC_URL = '/static/'

STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)

2 changes: 2 additions & 0 deletions python_blog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

urlpatterns = [
path('admin/', admin.site.urls, name='admin_url'),
path('blog/',views.articles_list_view),
path('modify_articles/', views.mod_articles, name='modify_articles_url'),
path('articles/<int:id_>/', views.article_view, name='article_url'),
path('tags/<int:id_>/', views.tag_view, name='tag_url'),
Expand All @@ -42,6 +43,7 @@
name='password_reset_confirm'),
path('reset_complete/', auth_views.PasswordResetCompleteView.as_view(),
name='password_reset_complete'),
path('all_discussion_boards/', board_views.discussion_boards, name='boards')
]

# links media files
Expand Down
5 changes: 5 additions & 0 deletions static/css/all.min.css

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions static/css/animate.min.css

Large diffs are not rendered by default.

255 changes: 255 additions & 0 deletions static/css/article_list.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@

/*--------------------------------------------------------------
# Header
--------------------------------------------------------------*/
#header {
padding: 30px 0;
height: 92px;
position: fixed;
left: 0;
top: 0;
right: 0;
transition: all 0.5s;
z-index: 997;
}

#header #logo {
float: left;
}

#header #logo h1 {
font-size: 36px;
margin: 0;
padding: 6px 0;
line-height: 1;
font-family: "Poppins", sans-serif;
font-weight: 700;
letter-spacing: 3px;
text-transform: uppercase;
}

#header #logo h1 a, #header #logo h1 a:hover {
color: #fff;
}

#header #logo img {
padding: 0;
margin: 0;
}

@media (max-width: 768px) {
#header #logo h1 {
font-size: 26px;
}
#header #logo img {
max-height: 40px;
}
}

#header.header-fixed {
background: rgba(52, 59, 64, 0.9);
padding: 20px 0;
height: 72px;
transition: all 0.5s;
}


/*--------------------------------------------------------------
# Hero Section
--------------------------------------------------------------*/
#hero {
width: 100%;
height: 100vh;
background: url("/static/img/header.jpg") top center;
opacity: 0.9;
background-size: cover;
position: relative;
}


@media (min-width: 1024px) {
#hero {
background-attachment: fixed;
}
}

#hero:before {
content: "";
background: rgba(0, 0, 0, 0.6);
position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
}

#hero .hero-container {
position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
text-align: center;
}

#hero h1 {
margin: 30px 0 10px 0;
font-size: 48px;
font-weight: 700;
line-height: 56px;
text-transform: uppercase;
color: #fff;
}

@media (max-width: 768px) {
#hero h1 {
font-size: 28px;
line-height: 36px;
}
}

#hero h2 {
color: #eee;
margin-bottom: 50px;
font-size: 24px;
}

@media (max-width: 768px) {
#hero h2 {
font-size: 18px;
line-height: 24px;
margin-bottom: 30px;
}
}

#hero .btn-get-started {
font-family: "Poppins", sans-serif;
text-transform: uppercase;
font-weight: 500;
font-size: 16px;
letter-spacing: 1px;
display: inline-block;
padding: 8px 28px;
border-radius: 50px;
transition: 0.5s;
margin: 10px;
border: 2px solid #fff;
color: #fff;
}

#hero .btn-get-started:hover {
background: #2dc997;
border: 2px solid #2dc997;
}


/* Main CSS */



.card{

max-width: 400px;
height: 500px;
margin: 10px;
border: 1px solid #e6e6e6;
border-radius: 10px;
position: relative;
background: #fafafa;
transition: all 0.3s;
}

.card:hover{

border : 2px solid #2dc997;
background-color: rgba(0, 0, 0, 0.1);

}

figure .cover{
height:100%;
width: 100%;
padding: 10px;
transform: scale(0.9);
transition: all 0.3s ease-in;

}

.card:hover .cover{
transform : scale(1);
}

.card-body h5{
font-weight: 700;
color : #2dca98;
}

.card-body .date{
font-weight: 700;

}

.card-body .author{
font-weight: 700;


}

.card .content{
margin-top: 5px;
}

.card .call-to-action{
margin : 10px;
margin-top : auto;
align-self: flex-start;
}






.card .call-to-action a{
display: block;
padding: 10px 15px;
color: #fff;
background-color: #2dc997;
text-decoration: none;
transition: all 0.3s;


}


.card .call-to-action a:hover{

border: 2px solid white;

}

/*--------------------------------------------------------------
# Footer
--------------------------------------------------------------*/
#footer {
background: #343b40;
padding: 30px 0;
color: #fff;
font-size: 14px;
}

#footer .copyright {
text-align: center;
}

#footer .credits {
padding-top: 10px;
text-align: center;
font-size: 13px;
color: #ccc;
}

Loading