Skip to content

Commit

Permalink
管理界面一键同意申请,删除给审核老师发的通知 (#841)
Browse files Browse the repository at this point in the history
* 管理界面一键同意申请,删除给审核老师发的通知

* 新建、修改、取消小组申请时,变为给智慧书院小组发通知

* Add comments to explain code changes
  • Loading branch information
Deophius authored Sep 5, 2024
1 parent 78d753c commit f881da3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
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

0 comments on commit f881da3

Please sign in to comment.