Skip to content

Commit

Permalink
Commented likes, views & comments sections with static content in blo…
Browse files Browse the repository at this point in the history
…g list & blog detail page and updated code
  • Loading branch information
shirishagaddi committed Mar 28, 2018
1 parent 73fe13a commit 96c5bda
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
33 changes: 16 additions & 17 deletions django_blog_it/django_blog_it/templates/posts/new_blog_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@
</div>
<br />
<div class="blog_detail_options">
<span class="reply"><a href="#"><i class="fa fa-reply"></i>Replies 123 </a></span>
<!--
<span class="reply"><a href="#"><i class="fa fa-reply"></i>Replies 123 </a></span>
<span class="likes"><a href="#"><i class="fa fa-thumbs-up" aria-hidden="true"></i> Likes 23 </a></span>
-->
</div>
<div class="social_block">
<ul class="social_connections">
Expand Down Expand Up @@ -99,7 +101,7 @@
<br clear="all">
</ul>
</div>
<span class="more"><a href="#">Leave Comment</a></span>
<!--<span class="more"><a href="#">Leave Comment</a></span>-->
</div>
</div>
</div>
Expand Down Expand Up @@ -142,7 +144,8 @@
</div>
{% endif %}
<!-- you_may_like ends here -->
<!-- view_comment starts here -->
<!-- view_comment starts here -->
<!--
<div class="view_comment">
<div class="panel panel-default view_comment_panel">
<div class="panel-body">
Expand Down Expand Up @@ -195,8 +198,10 @@
</div>
</div>
</div>
-->
<!-- leave_comment starts here -->
<!-- leave_comment starts here -->
<!-- leave_comment starts here -->
<!--
<div class="leave_comment">
<div class="panel panel-default leave_comment_panel">
<div class="panel-body">
Expand All @@ -207,34 +212,28 @@
<div class="leave_comment_form row">
<form action="#" method="post">
<div class="clearfix">

<div class="leave-comment-field col col-md-4">
<input name="author" type="text" value="" size="30" class=" form-control" placeholder="NAME *" aria-required="true">
</div><!-- .leave-comment-name -->

</div>
<div class="leave-comment-field col col-md-4">
<input name="email" type="text" value="" class=" form-control" size="30" placeholder="EMAIL *" aria-required="true">
</div><!-- .leave-comment-email -->

</div>
<div class="leave-comment-field col col-md-4 col-last">
<input name="url" type="text" value="" class=" form-control" size="30" placeholder="WEBSITE">
</div><!-- .leave-comment-website -->

</div><!-- .clearfix -->

</div>
</div>
<div class="leave-comment-field col-md-12">
<textarea name="comment" placeholder="COMMENT" aria-required="true"></textarea>
</div><!-- .leave-comment-message -->

</div>
<div class="leave-comment-submit">
<input name="submit" type="submit" id="submit" class="submit" value="SUBMIT YOUR COMMENT">
</div><!-- .leave-comment-submit -->

</div>
</form>
</div>
</div>
</div>
</div>
-->
<!-- leave_comment starts here -->
<div id="disqus_thread"></div>
<script>
Expand Down
2 changes: 2 additions & 0 deletions django_blog_it/django_blog_it/templates/posts/new_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ <h3 class="title" itemprop="headline"><a href="{% url 'blog_post_view' blog_slug
</div>
<div class="blog_detail_options">
<span class="activity">Posted on <span itemprop="datePublished" itemtype="https://schema.org/datePublished">{{ blog.updated_on|date:"F d, Y" }}</span></span>
<!--
<span class="reply"><a href="#"><i class="fa fa-reply"></i>Replies 123 </a></span>
<span class="views"><a href="#"><i class="fa fa-eye"></i> Views 123 </a></span>
<span class="likes"><a href="#"><i class="fa fa-thumbs-up" aria-hidden="true"></i> Likes 23 </a></span>
-->
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions django_blog_it/django_blog_it/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
urlpatterns = [
url(r'^$', admin_login, name='admin_login'),
url(r'^logout/$', admin_logout, name='admin_logout'),

# Blog
url(r'^blog/$', PostList.as_view(), name='blog'),
url(r'^add/$', PostCreatView.as_view(), name='blog_add'),
url(r'^view/(?P<blog_slug>[-\w]+)/$', PostDetailView.as_view(), name='view_blog'),
url(r'^delete/(?P<blog_slug>[-\w]+)/$', PostDeleteView.as_view(), name='delete_blog'),
url(r'^edit/(?P<blog_slug>[-\w]+)/$', edit_blog, name='edit_blog'),

# Categories
url(r'^add_category/$', add_category, name='add_category'),
url(r'^category/$', categories, name='categories'),
url(r'^delete_category/(?P<category_slug>[-\w]+)/$', delete_category, name='delete_category'),
Expand Down
12 changes: 7 additions & 5 deletions django_blog_it/django_blog_it/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
STATUS_CHOICE, ROLE_CHOICE, UserRole, Page, Theme, Google, Facebook, \
Post_Slugs
from .forms import *
# from django_blog_it import settings
from django.conf import settings
try:
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -127,7 +126,8 @@ def get_form_kwargs(self):
def form_valid(self, form):
self.blog_post = form.save(commit=False)
formset = inlineformset_factory(
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'), formset=CustomBlogSlugInlineFormSet)
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'),
formset=CustomBlogSlugInlineFormSet)
formset = formset(self.request.POST, instance=self.blog_post)
if not formset.is_valid():
return JsonResponse({'error': True, "response": formset.errors})
Expand Down Expand Up @@ -165,7 +165,9 @@ def get_context_data(self, **kwargs):
context['tags_list'] = tags_list
context['add_blog'] = True
self.formset = inlineformset_factory(
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'), formset=CustomBlogSlugInlineFormSet, widgets={'slug': forms.TextInput(attrs={'class': 'form-control'})})
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'),
formset=CustomBlogSlugInlineFormSet,
widgets={'slug': forms.TextInput(attrs={'class': 'form-control'})})
context['formset'] = self.formset()
return context

Expand Down Expand Up @@ -249,7 +251,8 @@ def get_context_data(self, **kwargs):
context['categories_list'] = categories_list
context['history_list'] = self.get_object().history.all()
self.formset = inlineformset_factory(
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'), formset=CustomBlogSlugInlineFormSet,
Post, Post_Slugs, can_delete=True, extra=3, fields=('slug', 'is_active'),
formset=CustomBlogSlugInlineFormSet,
widgets={'slug': forms.TextInput(attrs={'class': 'form-control'})})
context['formset'] = self.formset(instance=self.get_object())
return context
Expand Down Expand Up @@ -459,7 +462,6 @@ def get_user_role(user):
@csrf_exempt
def recent_photos(request):
''' returns all the images from the data base '''

imgs = []
for obj in Image_File.objects.filter(is_image=True).order_by("-date_created"):
upurl = obj.upload.url
Expand Down

0 comments on commit 96c5bda

Please sign in to comment.