Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复两处bug #10

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ tx_*.jpg
*/migrations/*
*.swp
*.un~
.idea
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

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

7 changes: 7 additions & 0 deletions .idea/misc.xml

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

8 changes: 8 additions & 0 deletions .idea/modules.xml

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

6 changes: 6 additions & 0 deletions .idea/vcs.xml

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

30 changes: 30 additions & 0 deletions .idea/vmaig_blog.iml

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

55 changes: 55 additions & 0 deletions .idea/workspace.xml

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

2 changes: 1 addition & 1 deletion blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Nav(models.Model):
name = models.CharField(max_length=40, verbose_name=u'导航条内容')
url = models.CharField(max_length=200, blank=True, null=True,
verbose_name=u'指向地址')

rank = models.IntegerField(default=0, verbose_name=u'排序')
status = models.IntegerField(default=0, choices=STATUS.items(),
verbose_name=u'状态')
create_time = models.DateTimeField(u'创建时间', auto_now_add=True)
Expand Down
Binary file modified blog/static/img/article/default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/docker1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/linux1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/mysql1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/python1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/redis0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/redis1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/shell1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/windows1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/img/article/zabbix1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified blog/static/img/bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified blog/static/img/favicon.ico
Binary file not shown.
Binary file added blog/static/img/myself/wx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/cat1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/cat2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/cat3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/cat4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/default.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/dog1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/dog2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/dog3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/pig1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/static/tx/tx-default.jog
Binary file not shown.
7 changes: 5 additions & 2 deletions blog/templates/blog/all.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
<div class="well">
<div class="sort">
<label>
<input type="radio" name="sort" value="time" checked="checked"> 按时间排序
<input type="radio" name="sort" value="default" checked="checked"> 默认排序
</label>
<label>
<input type="radio" name="sort" value="time"> 按时间排序
</label>
<label>
<input type="radio" name="sort" value="recommend"> 按热度排序
Expand Down Expand Up @@ -56,7 +59,7 @@
</div>

<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">
{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h1>{{article.title}}</h1>

<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">

{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
13 changes: 11 additions & 2 deletions blog/templates/blog/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@
<meta charset="UTF-8">
<!--手机html -->
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
<title>{{website_title}}</title>
{% if article %}
<title>{{article.category.name}}-{{article.title}}</title>
<meta name="keywords" content="{{article}}" />
<meta name="description" content="{{article}},运维开发路其慢慢修远兮,吾将上下而求索" />
{% else %}
<title>{{website_title}}</title>
<meta name="keywords" content="运维,运维开发,个人blog,blog,技术博客,博客" />
<meta name="description" content="技术博客,运维开发路其慢慢修远兮,吾将上下而求索" />
{% endif %}
<link rel="shortcut icon" href="/static/img/favicon.ico"/>
<link rel="bookmark" href="/static/img/favicon.ico"/>
{% compress css %}
Expand Down Expand Up @@ -36,7 +44,8 @@
</div>
<footer>
<div class="container">
<p class="text-center">基于Dajngo1.8,Bootsratp3, <a href="/sitemap.xml">网站地图</a></p>
<p class="text-center">Copyright © 2018-2020 灰狼 保留所有权利,<a href="https://tongji.baidu.com/">百度统计,</a><a href="/sitemap/sitemap.xml">网站地图</a></p>
<p class="text-center"><a href="http://www.miitbeian.gov.cn">渝ICP备18011705号-1</a></p>
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/category.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% endif %}
</div>
<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">
{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/column.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">

{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
4 changes: 4 additions & 0 deletions blog/templates/blog/include/all_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ <h1><a href="{{article_url}}">{{post.title}}</a></h1>
</div>
</div>
<div class="post-info">
<span>
<span class="glyphicon glyphicon-calendar"></span>
{{post.rank}}
</span>
<span>
<span class="glyphicon glyphicon-calendar"></span>
{{post.pub_time|date:"Y-m-d" }}
Expand Down
9 changes: 2 additions & 7 deletions blog/templates/blog/include/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@
全部文章
</a>
</li>
<li>
<a href="{{news_url}}">
<span class="glyphicon glyphicon-star-empty"></span>
资讯
</a>
</li>


{% if nav_list%}
{% for nav in nav_list%}
<li>
Expand Down Expand Up @@ -69,6 +63,7 @@
<span class="badge" style="background-color: #D94600;">{{notification_count}}</span>
</a>
<ul class="dropdown-menu navbar-right">
<li><a href="/admin"><span class="glyphicon glyphicon-user">进入后台</a></li>
<li><a href="{{changetx_url}}">
<span class="glyphicon glyphicon-user"></span>
更改头像</a></li>
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<!-- 右边的widgets -->
<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">
{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

</div>
<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">
{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
2 changes: 1 addition & 1 deletion blog/templates/blog/tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{% endif %}
</div>
<div id="vmaig-side" class="col-md-4 col-lg-3 hidden-xs">
{% include "blog/widgets/tags_cloud.html"%}
{% include "blog/widgets/my_info.html"%}
{% include "blog/widgets/search.html"%}
{% include "blog/widgets/hotest_posts.html"%}
{% include "vmaig_comments/latest_comments.html"%}
Expand Down
29 changes: 29 additions & 0 deletions blog/templates/blog/widgets/my_info.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<div id="vmaig-hotest-posts">
<div class="panel panel-vmaig">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-flag"></span>
关于我
<span class="glyphicon glyphicon-remove btn panel-close pull-right"></span>
<span class="glyphicon glyphicon-chevron-up btn panel-collapse pull-right" data-toggle="collapse" data-target="#hotest-post-list"></span>
</h3>
</div>
<ul class="list-group collapse in" style="display: flex;align-items: center;">
<div>
<a title="扫一扫联系我">
<img style="width: 140px;" src="../../static/img/myself/wx.png">
</a>
</div>
<div style="padding-left: 1px;">
<font color="#4f6371">
<font color="#ff9900">·</font><a title="这只是个化名">姓名:司徒飞</a><br>
<font color="#ff9900">·</font>代号:灰狼<br>
<font color="#ff9900">·</font>年龄:90一代<br>
<font color="#ff9900">·</font>博客:<a href="http://www.alewolf.com" target="_blank">http://www.alewolf.com</a><br>
<font color="#ff9900">·</font>邮箱:<script type="text/javascript">function copyText(obj) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);}</script><span id="myemail"><script language="JavaScript"></script>[email protected]</span> [<a href="#" title="复制E-mail地址到剪贴板" onclick="copyText(document.all.myemail)">复制</a>]<br>
<font color="#ff9900">·</font><a title="devops">职位:运维开发工程师</a><br>
<font color="#ff9900">·</font>籍贯:<a href="http://www.scpc.gov.cn/" target="_blank">四川省平昌县</a>
</div>
</ul>
</div>
</div>
12 changes: 6 additions & 6 deletions blog/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

urlpatterns = [
url(r'^$', IndexView.as_view(), name='index-view'),
url(r'^article/(?P<slug>\w+).html$',
url(r'^article/(?P<slug>[\s\S]*).html$',
ArticleView.as_view(), name='article-detail-view'),
url(r'^all/$', AllView.as_view(), name='all-view'),
url(r'^search/$', SearchView.as_view()),
Expand All @@ -22,13 +22,13 @@
url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',
TemplateView.as_view(template_name="blog/resetpassword.html"),
name='resetpassword-view'),
url(r'^column/(?P<column>\w+)/$',
url(r'^column/(?P<column>[\s\S]*)/$',
ColumnView.as_view(), name='column-detail-view'),
url(r'^user/(?P<slug>\w+)$', UserView.as_view(), name='user-view'),
url(r'^user/(?P<slug>[\s\S]*)$', UserView.as_view(), name='user-view'),
url(r'^news/$', NewsView.as_view(), name='news-view'),
url(r'^news/(?P<pk>\w+)$',
url(r'^news/(?P<pk>[\s\S]*)$',
DetailView.as_view(model=News), name='news-detail-view'),
url(r'^tag/(?P<tag>\w+)/$', TagView.as_view(), name='tag-detail-view'),
url(r'^category/(?P<category>\w+)/$',
url(r'^tag/(?P<tag>[\s\S]*)/$', TagView.as_view(), name='tag-detail-view'),
url(r'^category/(?P<category>[\s\S]*)/$',
CategoryView.as_view(), name='category-detail-view'),
]
3 changes: 2 additions & 1 deletion blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def get_context_data(self, *args, **kwargs):
context['hot_article_list'] = \
Article.objects.order_by("-view_times")[0:10]
# 导航条
context['nav_list'] = Nav.objects.filter(status=0)
# context['nav_list'] = Nav.objects.filter(status=0)
context['nav_list'] = Nav.objects.order_by('rank').filter(status=0)
# 最新评论
context['latest_comment_list'] = \
Comment.objects.order_by("-create_time")[0:10]
Expand Down
2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vmaig_blog.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "vmaig_blog.settings.dev")

from django.core.management import execute_from_command_line

Expand Down
4 changes: 2 additions & 2 deletions vmaig_blog/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,5 @@
QINIU_URL = ''

# 网站标题等内容配置
WEBSITE_TITLE = u'Vmaig'
WEBSITE_WELCOME = u'欢迎来到Vmaig,有问题欢迎加qq群458788510'
WEBSITE_TITLE = u'灰狼的blog'
WEBSITE_WELCOME = u'欢迎来到灰狼的blog,有问题欢迎加企鹅1744381765'
Loading