equal
deleted
inserted
replaced
12 notification.save() |
12 notification.save() |
13 notification.to = to |
13 notification.to = to |
14 notification.sub = subject |
14 notification.sub = subject |
15 notification.message = message |
15 notification.message = message |
16 notification.save() |
16 notification.save() |
|
17 |
|
18 def mark_notification_read(notification_id): |
|
19 """ |
|
20 makes a notification identified by the notification_id read. |
|
21 arguments: |
|
22 notification_id - a number denoting the id of the Notification object |
|
23 """ |
|
24 try: |
|
25 notification = Notification.objects.get(id = notification_id) |
|
26 except Notification.DoesNotExist: |
|
27 return False |
|
28 notification.is_read = True |
|
29 notification.save() |
|
30 return True |
|
31 |
|
32 def delete_notification(notification_id): |
|
33 """ |
|
34 deletes a notification identified by the notification_id. |
|
35 arguments: |
|
36 notification_id - a number denoting the id of the Notification object |
|
37 """ |
|
38 try: |
|
39 notification = Notification.objects.get(id = notification_id) |
|
40 except Notification.DoesNotExist: |
|
41 return False |
|
42 notification.deleted = True |
|
43 notification.save() |
|
44 return True |