Skip to content

Commit

Permalink
pagination fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
AliYmn committed Feb 6, 2017
1 parent 44a8f34 commit de83b59
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 104 deletions.
2 changes: 1 addition & 1 deletion blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Post(models.Model):
processors=[ResizeToFill(800, 400)],
format='JPEG',
options={'quality': 50},verbose_name="Öne Çıkan Görsel",
help_text="Öne çıkan görseli oluşturur.",blank=True)
help_text="Öne çıkan görseli oluşturur.")
#kategoriler
category_list = models.ForeignKey(Category, null=True, blank=True,
db_index=True,verbose_name="Kategoriler")
Expand Down
2 changes: 1 addition & 1 deletion static/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

111 changes: 44 additions & 67 deletions templates/blog_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,89 +17,66 @@

{% block category %}
<li class="dropdown">
<a href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Kategoriler <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for i in category %}
<li><a href="/kategori/{{ i.url }}">{{ i.title }}</a></li>
{% endfor %}
</ul>
</li>
<a href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Kategoriler <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for i in category %}
<li><a href="/kategori/{{ i.url }}">{{ i.title }}</a></li>
{% endfor %}
</ul>
</li>
{% endblock %}

{% block content %}


{% block content %}
<div class="row-fluid top30 pagetitle">

<div class="container">

<div class="row">

<div class="col-md-12"><br></div>


</div>

</div>



<div class="container">
<div class="row">
<div class="col-md-12"><br></div>
</div>
</div>
</div>
<div class="container">


<div class="row">

{% for i in post_obj %}
<div class="row">
</div>
<div class="col-sm-12">
<h3 class="title"><a href="/{{ i.url }}">{{ i.title }}</a></h3>
<span class="title">{{ i.content | safe | truncatechars_html:300 }}</span>
<hr>
<p class="text-muted"> <i class="fa fa-hashtag" aria-hidden="true"></i> Etiketler : <a href="/{{ i.url }}">{{ i.tags }}</a></p>

</div>

<div class="row">
{% for i in post_obj %}
<div class="row">
</div>
<div class="col-sm-12">
<h3 class="title"><a href="/{{ i.url }}">{{ i.title }}</a></h3>
<span class="title">{{ i.content | safe | truncatechars_html:300 }}</span>
<hr>
<p class="text-muted"> <i class="fa fa-hashtag" aria-hidden="true"></i> Etiketler : <a href="/{{ i.url }}">{{ i.tags }}</a></p>
</div>
{% endfor %}
<hr>

{% if is_paginated %}
<div class="pagination-wrapper">
<ul class="pager">
{% if is_paginated %}
<nav>
<ul class="pager">
{% if page_obj.has_previous %}
<li class="blog-pagination"><a href="?page={{ page_obj.previous_page_number }}">Geri</a></li>
<li class="previous blog-pagination"><a href="?page={{ page_obj.previous_page_number }}">Geri</a></li>
{% endif %}
{% for page in page_numbers %}
{% if page %}
{% ifequal page page_obj.number %}
<li class="disabled"><a href="#">{{ page }}</a></li>
{% else %}
<li><a href="?page={{ page }}">{{ page }}</a></li>
{% endifequal %}
{% else %}
{% endif %}
{% for page in page_numbers %}
{% if page %}
{% ifequal page page_obj.number %}
<li class="disabled"><a href="#">{{ page }}</a></li>
{% else %}
<li><a href="?page={{ page }}">{{ page }}</a></li>
{% endifequal %}
{% else %}
...
{% endif %}
{% endfor %}
{% endfor %}

{% if page_obj.has_next %}
<li class="blog-pagination"><a href="?page={{ page_obj.next_page_number }}">İleri</a></li>
<li class="next blog-pagination"><a href="?page={{ page_obj.next_page_number }}">İleri</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
</ul>
</div>
{% endif %}

</div>
</div>
</div>

{% endblock %}
</div>
{% endblock %}

{% block last_content %}

{% for last_post in last_content %}

<a href="/{{ last_post.url }}"><i class="fa fa-share" aria-hidden="true"></i> {{ last_post.title }}</a><br/>

{% endfor %}

{% endblock %}
63 changes: 28 additions & 35 deletions templates/post.html
Original file line number Diff line number Diff line change
@@ -1,63 +1,56 @@
{% extends 'base.html' %}
{% load static %}
{% load blog_tags %}
{% load disqus_tags %}


{% block title %}{{ post_obj.title }} - Kişisel Blog{% endblock %}
{% block title %}{{ post_obj.title }} | {% site_slogan %}{% endblock %}
{% block meta_title %}{{ post_obj.title }}{% endblock %}
{% block description %}{{ post_obj.description }}{% endblock %}
{% block keywords %}{{ post_obj.tags }}{% endblock %}
<!-- SEO -->
{% block og_title %}{{ post_obj.title }}{% endblock %}
{% block og_description %}{{ post_obj.description }}{% endblock %}
{% block og_url %}{{request.get_raw_uri}}{% endblock %}
{% block og_image %}{{ post_obj.image.url }}{% endblock %}
{% block og_site_name %}{% site_title %} - {% site_slogan %}{% endblock %}
{% block og_image %}{{request.get_raw_uri}}{{ post_obj.image.url }}{% endblock %}
{% block og_site_name %}{{ post_obj.title }} | {% site_slogan %}{% endblock %}

{% block category %}
<li class="dropdown">
<a href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Kategoriler <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for i in category %}
<li><a href="/kategori/{{ i.url }}">{{ i.title }}</a></li>
{% endfor %}
</ul>
</li>
<a href="#" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Kategoriler <span class="caret"></span></a>
<ul class="dropdown-menu">
{% for i in category %}
<li><a href="/kategori/{{ i.url }}">{{ i.title }}</a></li>
{% endfor %}
</ul>
</li>
{% endblock %}
<script>hljs.initHighlightingOnLoad();</script>
{% block content %}

<!-- +++++ Projects Section +++++ -->
<div class="container pt ">
<div class="row mt">
<div class="col-lg-12 col-lg-offset-0">
{% block content %}
<script>hljs.initHighlightingOnLoad();</script>
<div class="container pt ">
<div class="row mt">
<div class="col-lg-12 col-lg-offset-0">
<div class="col-sm-12"><a href="/{{ post_obj.url }}" class=""><img src="{{ post_obj.image.url }}" class="img-responsive"></a></div>
<center><h3>{{ post_obj.title }}</h3></center>
<hr>
{{ post_obj.content | safe }}
</div>
</div>
<div class="row mt centered">
<p><bt>Yazar : <span class="renk">{% site_author %}</span></bt> - <bt>Kategori: <a href="/kategori/{{ post_obj.category_list.url }}">{{ post_obj.category_list }}</a></bt> - <bt>Tarih: <span class="renk">{{ post_obj.time.date }}</span></bt></p>
</div><!-- /row -->
{% load disqus_tags %}
{% disqus_show_comments %}
</div><!-- /container -->

<center><h3>{{ post_obj.title }}</h3></center>
<hr>
{{ post_obj.content | safe }}
</div>
</div>
<div class="row mt centered">
<p><bt>Yazar : <span class="renk">{% site_author %}</span></bt> - <bt>Kategori: <a href="/kategori/{{ post_obj.category_list.url }}">{{ post_obj.category_list }}</a></bt> - <bt>Tarih: <span class="renk">{{ post_obj.time.date }}</span></bt></p>
{% disqus_show_comments %}
</div><!-- /row -->
</div><!-- /container -->
{% endblock %}


{% block last_content %}

{% for last_post in last_content %}

<a href="/{{ last_post.url }}"><i class="fa fa-share" aria-hidden="true"></i> {{ last_post.title }}</a><br/>

{% endfor %}

{% endblock %}

{% block footer %}
<link rel="stylesheet" href="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/styles/default.css' %}" />
<script src="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js' %}"></script>
<link rel="stylesheet" href="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/styles/default.css' %}" />
<script src="{% static 'ckeditor/ckeditor/plugins/codesnippet/lib/highlight/highlight.pack.js' %}"></script>
{% endblock %}

0 comments on commit de83b59

Please sign in to comment.