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
14 changes: 10 additions & 4 deletions mysite/blog/static/blog/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ h4,
h6 {
color: #444444;
}

ul {
margin: 0;
}

ul {
margin: 0;
list-style: none;
}

ul li:before {
content: "\00BB \0020";
}

.bg-steel {
background-color: #5f788a;
Expand Down Expand Up @@ -314,6 +319,7 @@ label {
z-index: 0;
visibility: hidden;
}

}
.slider > #input-slide-autoplay:checked ~ .slide-description > .slide-0 {
animation: description 32000ms infinite -2000ms ease;
Expand Down
8 changes: 5 additions & 3 deletions mysite/blog/templates/blog/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,17 @@
<!--Slider End-->
<span style="display:inline-block; width: 3px;"></span>
{% include 'user/message.html' %}

<div class="row">
<div class="col-md-8">
{% block content %}
{% endblock %}
</div>
<div class="col-md-4">
<div class="content-section filter-section position-sticky">
{% block contentr %}

{% endblock %}
<h3>Filter By</h3>
<hr style="height: 5px;" />
<div class="custom-control custom-checkbox">
Expand All @@ -109,7 +112,7 @@ <h3>Trending</h3>

</div>
</div>

</div>
</main>

Expand All @@ -123,4 +126,3 @@ <h3>Trending</h3>
<script src="{% static '/blog/main.js' %}"></script>
</body>
</html>

15 changes: 14 additions & 1 deletion mysite/blog/templates/blog/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h2><a id="post_title_{{ forloop.counter }}" class="article-title" href="{% url
<div style="float:right;">
<img style="height:19px; width:18px;" src="{% static 'blog/viewicon.png' %}">
<p style="float: right; display: inline !important;" id="ViewCount_{{ forloop.counter }}">

</p>
</img>
</div>
Expand Down Expand Up @@ -145,3 +145,16 @@ <h2><a id="post_title_{{ forloop.counter }}" class="article-title" href="{% url
</div>

{% endblock%}

{% block contentr %}
<div class="content-section">
<ul>
<h4>Latest Posts</h4>
{% for post in postsl %}

<li><a href="{% url 'post-detail' post.id %}">{{ post.title }}</a></li>
<small>{{ post.date_posted }}</small>

{% endfor %}
</div>
{% endblock %}
1 change: 1 addition & 0 deletions mysite/blog/templates/blog/post_detail.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

{% extends "blog/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
Expand Down
1 change: 1 addition & 0 deletions mysite/blog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
path("post/<int:pk>/update/", PostUpdateView.as_view(), name="post-update"),
path("post/<int:pk>/delete/", PostDeleteView.as_view(), name="post-delete"),
path("post_create/", post_create, name="post_create"),

]
14 changes: 10 additions & 4 deletions mysite/blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
from django.http import HttpResponse
from .models import Post, Comment
from django.contrib.auth.models import User
from django.db.models import Q
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin

from django.views.generic import ListView, DetailView, UpdateView, DeleteView
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .forms import PostForm, CommentForm
from django.db.models import Q
from django.shortcuts import render, get_object_or_404
from django.core.paginator import Paginator
from django.http import JsonResponse
from django.utils import timezone
Expand Down Expand Up @@ -42,10 +45,11 @@ def home(request):

context = {
'posts': posts,
'mostliked1': mostliked1,
'mostliked2': mostliked2,
'mostliked3': mostliked3,
'mostliked4': mostliked4,
'mostliked1':mostliked1,
'mostliked2':mostliked2,
'mostliked3':mostliked3,
'mostliked4':mostliked4,
'postsl': Post.objects.all().order_by('-date_posted')[:5]
}
return render(request, 'blog/home.html', context)

Expand All @@ -54,6 +58,7 @@ def about(request):
return render(request, 'blog/about.html')



def Profileview(request, name):
user = User.objects.get(username=name)
posts = user.post_set.all()
Expand Down Expand Up @@ -161,3 +166,4 @@ def post_create(request):
# For 404 Error Handling
def view_404(request, exception):
return render(request, 'blog/404.html')

Binary file modified mysite/db.sqlite3
Binary file not shown.