diff --git a/app/migrations/0003_remove_modifyorganization_tags.py b/app/migrations/0003_remove_modifyorganization_tags.py new file mode 100644 index 000000000..2db8f3f96 --- /dev/null +++ b/app/migrations/0003_remove_modifyorganization_tags.py @@ -0,0 +1,16 @@ +# Generated by Django 5.0.9 on 2025-01-05 16:54 + +from django.db import migrations + + +class Migration(migrations.Migration): + dependencies = [ + ("app", "0002_delete_freshman"), + ] + + operations = [ + migrations.RemoveField( + model_name="modifyorganization", + name="tags", + ), + ] diff --git a/app/models.py b/app/models.py index 772ace261..91c5c2d89 100644 --- a/app/models.py +++ b/app/models.py @@ -1200,7 +1200,6 @@ class Status(models.IntegerChoices): # 表示申请小组的请求的状态 REFUSED = (3, "已拒绝") status = models.SmallIntegerField(choices=Status.choices, default=0) - tags = models.CharField(max_length=100, default='', blank=True) def __str__(self): # YWolfeee: 不认为应该把类型放在如此重要的位置 diff --git a/app/org_utils.py b/app/org_utils.py index 6ca80903f..cf6f38905 100644 --- a/app/org_utils.py +++ b/app/org_utils.py @@ -48,6 +48,9 @@ def find_max_oname(): organizations = Organization.objects.filter( organization_id__username__startswith="zz" ).order_by("-organization_id__username") + if not organizations.exists(): + # TODO: remove hard code + return "zz10001" max_org: Organization = organizations[0] max_oname = str(max_org.get_user().username) max_oname = int(max_oname[2:]) + 1 @@ -223,7 +226,6 @@ def update_org_application(application: ModifyOrganization, me: NaturalPerson, r pos=me.person_id, introduction=info.get('introduction'), application=info.get('application'), - tags=info.get('tags_modify') ) if context["avatar"] is not None: application.avatar = context['avatar']; @@ -242,16 +244,14 @@ def update_org_application(application: ModifyOrganization, me: NaturalPerson, r if (application.oname == info.get("oname") and application.introduction == info.get('introduction') and application.avatar == info.get('avatar', None) - and application.application == info.get('application') - and application.tags == info.get('tags_modify')): + and application.application == info.get('application')): return wrong("没有检测到修改!") # 至此可以发起修改 ModifyOrganization.objects.filter(id=application.id).update( oname=info.get('oname'), #otype=OrganizationType.objects.get(otype_name=info.get('otype')), introduction=info.get('introduction'), - application=info.get('application'), - tags=info.get('tags_modify')) + application=info.get('application')) if context["avatar"] is not None: application.avatar = context['avatar'] application.save() @@ -513,8 +513,8 @@ def make_relevant_notification(application: ModifyPosition | ModifyOrganization, else: raise NotImplementedError applyer_id = apply_person.person_id - # 小组申请现在由运营初步审核,所以通知发给智慧书院小组 - applyee_id = User.objects.get(username = GLOBAL_CONFIG.official_uid) + # Revert to incharge id + applyee_id = inchage_person.person_id not_type = Notification.Title.NEW_ORGANIZATION URL = f'/modifyOrganization/?org_id={application.id}' diff --git a/app/org_views.py b/app/org_views.py index 1de4679d1..77f9ca317 100644 --- a/app/org_views.py +++ b/app/org_views.py @@ -136,10 +136,7 @@ def modifyOrganization(request: UserRequest): # 处理通知相关的操作,并根据情况发送微信 # 默认需要成功,失败也不是用户的问题,直接给管理员报错 TODO - try: - make_relevant_notification(application, request.POST) - except: - raise NotImplementedError + make_relevant_notification(application, request.POST) elif context["warn_code"] != 1: # 没有返回操作提示 raise NotImplementedError("处理小组申请中出现未预见状态,请联系管理员处理!")