Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3ec3dd1d64
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue