forked from pbiqa59u2/Git
Compare commits
18 Commits
ZZH_branch
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
8cc10f2d8f | 3 months ago |
|
|
b70127e822 | 3 months ago |
|
|
fc8b5f1517 | 3 months ago |
|
|
8f8f7e903f | 4 months ago |
|
|
a40200b4a3 | 4 months ago |
|
|
219faa271d | 4 months ago |
|
|
4f748d27de | 4 months ago |
|
|
cece26dbac | 4 months ago |
|
|
ec87019888 | 4 months ago |
|
|
b9fd87bdb7 | 4 months ago |
|
|
2a78b45096 | 5 months ago |
|
|
67316de031 | 5 months ago |
|
|
178f800fd4 | 5 months ago |
|
|
64b05112d9 | 5 months ago |
|
|
149ac47a39 | 5 months ago |
|
|
37beab6fd5 | 5 months ago |
|
|
7cae40c947 | 5 months ago |
|
|
bb483434d7 | 5 months ago |
@ -1 +0,0 @@
|
||||
undefine
|
||||
@ -1 +0,0 @@
|
||||
This is for doc folder
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@
|
||||
# 文档目录 - 项目文档将存放于此
|
||||
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 显示脚本开始执行
|
||||
echo "脚本开始执行..."
|
||||
|
||||
# 从键盘读取文件名
|
||||
read -p "请输入文件名: " filename
|
||||
|
||||
# 检查文件是否存在
|
||||
if [ ! -e "$filename" ]; then
|
||||
echo "错误:文件 '$filename' 不存在!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "文件 '$filename' 存在"
|
||||
|
||||
# 检查文件是否是符号链接
|
||||
if [ -L "$filename" ]; then
|
||||
echo "检测到 '$filename' 是一个符号链接文件"
|
||||
|
||||
# 获取文件名部分(不包括路径)
|
||||
base_name=$(basename "$filename")
|
||||
|
||||
# 移动文件到/tmp目录
|
||||
echo "正在将 '$filename' 移动到 /tmp/$base_name"
|
||||
mv "$filename" "/tmp/$base_name"
|
||||
|
||||
# 检查移动是否成功
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "移动成功!文件现在位于 /tmp/$base_name"
|
||||
else
|
||||
echo "移动失败!"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "'$filename' 不是符号链接文件,不进行任何处理"
|
||||
fi
|
||||
|
||||
echo "脚本执行完毕"
|
||||
exit 0
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
undefined
|
||||
@ -0,0 +1,10 @@
|
||||
# apps.py - Django应用程序配置文件
|
||||
|
||||
# 导入Django应用配置基类
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
# 定义账户应用的配置类
|
||||
class AccountsConfig(AppConfig):
|
||||
# 指定应用程序的完整Python路径
|
||||
name = 'accounts'
|
||||
@ -0,0 +1,47 @@
|
||||
from django.contrib import admin
|
||||
from django.urls import reverse
|
||||
from django.utils.html import format_html
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
def disable_commentstatus(modeladmin, request, queryset):
|
||||
queryset.update(is_enable=False) # 杨智鑫:批量设置评论为禁用状态
|
||||
|
||||
|
||||
def enable_commentstatus(modeladmin, request, queryset):
|
||||
queryset.update(is_enable=True) # 杨智鑫:批量设置评论为启用状态
|
||||
|
||||
|
||||
disable_commentstatus.short_description = _('Disable comments') # 杨智鑫:批量禁用评论
|
||||
enable_commentstatus.short_description = _('Enable comments') # 杨智鑫:批量启用评论
|
||||
|
||||
|
||||
class CommentAdmin(admin.ModelAdmin):
|
||||
list_per_page = 20
|
||||
list_display = (
|
||||
'id',
|
||||
'body',
|
||||
'link_to_userinfo',
|
||||
'link_to_article',
|
||||
'is_enable',
|
||||
'creation_time') # 杨智鑫:显示
|
||||
list_display_links = ('id', 'body', 'is_enable') # 杨智鑫:可点击
|
||||
list_filter = ('is_enable',) # 杨智鑫:过滤
|
||||
exclude = ('creation_time', 'last_modify_time') # 杨智鑫:不显示创建时间
|
||||
actions = [disable_commentstatus, enable_commentstatus] # 杨智鑫:批量操作
|
||||
|
||||
def link_to_userinfo(self, obj):
|
||||
info = (obj.author._meta.app_label, obj.author._meta.model_name) # 杨智鑫:获取用户信息
|
||||
link = reverse('admin:%s_%s_change' % info, args=(obj.author.id,)) # 杨智鑫:获取用户信息
|
||||
return format_html(
|
||||
u'<a href="%s">%s</a>' %
|
||||
(link, obj.author.nickname if obj.author.nickname else obj.author.email)) # 杨智鑫:获取用户信息
|
||||
|
||||
def link_to_article(self, obj):
|
||||
info = (obj.article._meta.app_label, obj.article._meta.model_name)
|
||||
link = reverse('admin:%s_%s_change' % info, args=(obj.article.id,)) # 杨智鑫:获取文章信息
|
||||
return format_html(
|
||||
u'<a href="%s">%s</a>' % (link, obj.article.title)) # 杨智鑫:获取文章信息
|
||||
|
||||
link_to_userinfo.short_description = _('User') # 杨智鑫:用户
|
||||
link_to_article.short_description = _('Article') # 杨智鑫:文章
|
||||
@ -0,0 +1,11 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = "comments" # 杨智鑫:定义应用命名空间
|
||||
urlpatterns = [
|
||||
path(
|
||||
'article/<int:article_id>/postcomment',
|
||||
views.CommentPostView.as_view(), # 杨智鑫:定义路由
|
||||
name='postcomment'), # 杨智鑫:定义路由名称
|
||||
]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue