add message
This commit is contained in:
parent
0150bf4f8d
commit
8116692491
|
@ -98,6 +98,9 @@ class Task(models.Model):
|
||||||
def record(self):
|
def record(self):
|
||||||
return TaskRecord.objects.filter(task=self).count()
|
return TaskRecord.objects.filter(task=self).count()
|
||||||
|
|
||||||
|
def records(self):
|
||||||
|
return TaskRecord.objects.filter(task=self)
|
||||||
|
|
||||||
def add_task_message(self, user_id):
|
def add_task_message(self, user_id):
|
||||||
for group in self.groups.all():
|
for group in self.groups.all():
|
||||||
Message.objects.create(
|
Message.objects.create(
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -16,7 +16,7 @@ def notices(request):
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
return HttpResponse(status=405)
|
return HttpResponse(status=405)
|
||||||
id = request.user.id
|
id = request.user.id
|
||||||
notices = Notice.objects.filter(user__id=id, is_read=False)
|
notices = Notice.objects.filter(user__id=id)
|
||||||
results = []
|
results = []
|
||||||
for o in notices:
|
for o in notices:
|
||||||
result = dict()
|
result = dict()
|
||||||
|
|
|
@ -88,6 +88,12 @@ def get_task(request):
|
||||||
result['content'] = task.content
|
result['content'] = task.content
|
||||||
result['total'] = task.total()
|
result['total'] = task.total()
|
||||||
result['record'] = task.record()
|
result['record'] = task.record()
|
||||||
|
# records = task.records()
|
||||||
|
# n = []
|
||||||
|
# for r in records:
|
||||||
|
# p = dict()
|
||||||
|
# profile = r.user.profile
|
||||||
|
# print(profile)
|
||||||
result['added'] = task.added.strftime("%Y-%m-%d %H:%M:%S")
|
result['added'] = task.added.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
return JsonResponse({'status': 'success', 'message': result})
|
return JsonResponse({'status': 'success', 'message': result})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue