equal
deleted
inserted
replaced
|
1 from django.http import Http404 |
|
2 from django.contrib.auth.models import User |
1 from pytask.profile.models import Notification |
3 from pytask.profile.models import Notification |
2 |
4 |
3 def get_notification(nid, user): |
5 def get_notification(nid, user): |
4 """ if notification exists, and belongs to the current user, return it. |
6 """ if notification exists, and belongs to the current user, return it. |
5 else return None. |
7 else return None. |
28 |
30 |
29 return newest_notification, newer_notification, current_notification, older_notification, oldest_notification |
31 return newest_notification, newer_notification, current_notification, older_notification, oldest_notification |
30 |
32 |
31 else: |
33 else: |
32 return None, None, None, None, None |
34 return None, None, None, None, None |
|
35 |
|
36 def get_user(uid): |
|
37 |
|
38 try: |
|
39 user = User.objects.get(id=uid) |
|
40 except User.DoesNotExist: |
|
41 raise Http404 |
|
42 |
|
43 if user.is_active: |
|
44 return user |
|
45 else: |
|
46 raise Http404 |
|
47 |