You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
510 B
18 lines
510 B
from djangoblog.plugin_manage.base_plugin import BasePlugin
|
|
from djangoblog.plugin_manage import hooks
|
|
|
|
|
|
class ViewCountPlugin(BasePlugin):
|
|
PLUGIN_NAME = '文章浏览次数统计'
|
|
PLUGIN_DESCRIPTION = '统计文章的浏览次数'
|
|
PLUGIN_VERSION = '0.1.0'
|
|
PLUGIN_AUTHOR = 'liangliangyy'
|
|
|
|
def register_hooks(self):
|
|
hooks.register('after_article_body_get', self.record_view)
|
|
|
|
def record_view(self, article, *args, **kwargs):
|
|
article.viewed()
|
|
|
|
|
|
plugin = ViewCountPlugin() |