diff --git a/dashboard/models.py b/dashboard/models.py index 6e98ecc..d64ed18 100644 --- a/dashboard/models.py +++ b/dashboard/models.py @@ -119,7 +119,6 @@ class Organization(models.Model): class Meta: ordering = ["name"] - def __str__(self): return self.name @@ -143,6 +142,12 @@ class Userprofile(models.Model): class Meta: ordering = ["-created"] + def is_level1(self): + return self.organization.level.level == 1 + + def is_level2(self): + return self.organization.level.level == 2 + def __str__(self): return self.user.username+":"+self.name diff --git a/polls/models.py b/polls/models.py index 9b24c59..b2144d4 100644 --- a/polls/models.py +++ b/polls/models.py @@ -50,8 +50,11 @@ class Notice(models.Model): field = models.CharField('field', max_length=256, null=True, blank=True) record_id = models.CharField( 'record_id', max_length=256, null=True, blank=True) - record_value = models.CharField( - 'record_value', max_length=256, null=True, blank=True) + record_pass_value = models.CharField( + 'record_pass_value', max_length=256, null=True, blank=True) + record_reject_value = models.CharField( + 'record_reject_value', max_length=256, null=True, blank=True) + is_read = models.BooleanField('是否阅读', default=False) added = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) diff --git a/polls/views/__pycache__/media.cpython-38.pyc b/polls/views/__pycache__/media.cpython-38.pyc index 31447ac..65f6d53 100644 Binary files a/polls/views/__pycache__/media.cpython-38.pyc and b/polls/views/__pycache__/media.cpython-38.pyc differ diff --git a/polls/views/__pycache__/notice.cpython-38.pyc b/polls/views/__pycache__/notice.cpython-38.pyc index f99fc07..2f9b6bc 100644 Binary files a/polls/views/__pycache__/notice.cpython-38.pyc and b/polls/views/__pycache__/notice.cpython-38.pyc differ diff --git a/polls/views/notice.py b/polls/views/notice.py index 6d11337..c87386d 100644 --- a/polls/views/notice.py +++ b/polls/views/notice.py @@ -62,6 +62,25 @@ def read_notice(request): return JsonResponse({'status': 'error', 'message': '通知ID错误'}) +@csrf_exempt +@polls_login_required +def detail_notice(request, notice_id): + if request.method == 'GET': + return HttpResponse(status=405) + notice_id = request.POST.get('notice') + if not notice_id: + return JsonResponse({'status': 'error', 'message': '通知ID错误'}) + try: + notice = Notice.objects.get(id=notice_id) + results = dict() + results['id'] = notice.id + + + return JsonResponse({'status': 'success', 'message': results}) + except ObjectDoesNotExist: + return JsonResponse({'status': 'error', 'message': '通知ID错误'}) + + @csrf_exempt @polls_login_required def reply_notice(request):