add reject value

This commit is contained in:
baoliang 2020-09-30 16:02:29 +08:00
parent 7c25ed8b69
commit 290a2021ce
5 changed files with 30 additions and 3 deletions

View File

@ -119,7 +119,6 @@ class Organization(models.Model):
class Meta: class Meta:
ordering = ["name"] ordering = ["name"]
def __str__(self): def __str__(self):
return self.name return self.name
@ -143,6 +142,12 @@ class Userprofile(models.Model):
class Meta: class Meta:
ordering = ["-created"] 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): def __str__(self):
return self.user.username+":"+self.name return self.user.username+":"+self.name

View File

@ -50,8 +50,11 @@ class Notice(models.Model):
field = models.CharField('field', max_length=256, null=True, blank=True) field = models.CharField('field', max_length=256, null=True, blank=True)
record_id = models.CharField( record_id = models.CharField(
'record_id', max_length=256, null=True, blank=True) 'record_id', max_length=256, null=True, blank=True)
record_value = models.CharField( record_pass_value = models.CharField(
'record_value', max_length=256, null=True, blank=True) '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) is_read = models.BooleanField('是否阅读', default=False)
added = models.DateTimeField(auto_now_add=True) added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True) updated = models.DateTimeField(auto_now=True)

View File

@ -62,6 +62,25 @@ def read_notice(request):
return JsonResponse({'status': 'error', 'message': '通知ID错误'}) 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 @csrf_exempt
@polls_login_required @polls_login_required
def reply_notice(request): def reply_notice(request):