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

管理界面一键同意申请,删除给审核老师发的通知 #841

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from app.models import *
from scheduler.cancel import remove_job
from app.YQPoint_utils import run_lottery
from app.org_utils import accept_modifyorg_submit

# 通用内联模型
@readonly_inline
Expand Down Expand Up @@ -638,8 +639,14 @@ class ModifyOrganizationAdmin(admin.ModelAdmin):
list_display = ["id", "oname", "otype", "pos", "get_poster_name", "status"]
search_fields = ("id", "oname", "otype__otype_name", "pos__username",)
list_filter = ('status', "otype", 'time', 'modify_time',)
actions = []
ModifyOrganization.get_poster_name.short_description = "申请者"

@as_action("同意申请", actions, 'change', update = True)
def approve_requests(self, request, queryset: QuerySet['ModifyOrganization']):
for application in queryset:
accept_modifyorg_submit(application)
self.message_user(request, '操作成功完成!')

@admin.register(Course)
class CourseAdmin(admin.ModelAdmin):
Expand Down
6 changes: 4 additions & 2 deletions app/org_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,16 @@ def make_relevant_notification(application: ModifyPosition | ModifyOrganization,
else:
raise NotImplementedError
applyer_id = apply_person.person_id
applyee_id = inchage_person.person_id
# 小组申请现在由运营初步审核,所以通知发给智慧书院小组
applyee_id = User.objects.get(username = GLOBAL_CONFIG.official_uid)
not_type = Notification.Title.NEW_ORGANIZATION
URL = f'/modifyOrganization/?org_id={application.id}'

sender = applyer_id if feasible_post.index(post_type) < 3 else applyee_id
receiver = applyee_id if feasible_post.index(post_type) < 3 else applyer_id
# 通过新小组申请是在后台进行的,只有在处理新的职位申请时需要跳转到申请页面处理
typename = (Notification.Type.NEEDDO
if post_type == 'new_submit'
if post_type == 'new_submit' and isinstance(application, ModifyPosition)
else Notification.Type.NEEDREAD)
title = Notification.Title.VERIFY_INFORM if post_type != 'accept_submit' else not_type
relate_instance = application if post_type == 'new_submit' else None
Expand Down
Loading