Skip to content

Commit

Permalink
postdetails update.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliYmn committed Feb 12, 2017
1 parent 5fdd21f commit bf4c73a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions blog/views.py
@@ -1,6 +1,8 @@
from django.views.generic import ListView,TemplateView,DetailView
from .models import Post,Category,Love,Skills,IpController,Tags
from django.shortcuts import get_list_or_404
from django.http import HttpResponse

class HomeListView(ListView):
"""Ana Sayfa"""
model = Post
Expand All @@ -14,6 +16,7 @@ def get_context_data(self, **kwargs):
context['last_content'] = Post.objects.all().filter(is_active=True).order_by('-time')
return context


class PostDetailView(DetailView):
"""Post detay sayfası"""
model = Post
Expand All @@ -22,10 +25,6 @@ class PostDetailView(DetailView):
slug_field = 'url'

def get_context_data(self, **kwargs):
tags = []
post_tags = []
posts_tags = []

context = super(PostDetailView, self).get_context_data(**kwargs)
context['last_content'] = Post.objects.all().filter(is_active=True).order_by('-time')[:5]
context['category'] = Category.objects.all()
Expand All @@ -35,7 +34,7 @@ def get_context_data(self, **kwargs):
http_x=str(self.request.META.get('HTTP_X_FORWARDED_FOR')),
http_user=str(self.request.META['HTTP_USER_AGENT']),
url=str(self.kwargs['slug']))
if(not ip):
if(ip):
IpController.objects.create(remote=str(self.request.META.get('REMOTE_ADDR')),
http_x=str(self.request.META.get('HTTP_X_FORWARDED_FOR')),
http_user=str(self.request.META['HTTP_USER_AGENT']),
Expand Down

0 comments on commit bf4c73a

Please sign in to comment.