notification package¶
Submodules¶
notification.models module¶
-
class
notification.models.
Notification
(id, user, datetime, text, target_type, target_id, link_type, link_item, reference_detail)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Notification.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Notification.
get_next_by_datetime
(*moreargs, **morekwargs)¶
-
Notification.
get_previous_by_datetime
(*moreargs, **morekwargs)¶
-
Notification.
link_type
¶
-
Notification.
objects
= <django.db.models.manager.Manager object>¶
-
Notification.
readed
¶
-
Notification.
receiver
¶
-
Notification.
target_object
¶ Provides a generic relation to any object through content-type/object-id fields.
-
Notification.
target_type
¶
-
Notification.
user
¶
-
Notification.
usernotification_set
¶
-
exception
-
class
notification.models.
UserNotification
(id, notification, receiver)[source]¶ Bases:
django.db.models.base.Model
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
UserNotification.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
UserNotification.
notification
¶
-
UserNotification.
objects
= <django.db.models.manager.Manager object>¶
-
UserNotification.
receiver
¶
-
exception
notification.serializer module¶
-
class
notification.serializer.
GetNotificationSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
notification.serializer.
NotificationSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
notification.serializer.
TypeSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
notification.serializer.
UpdateNotificationSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
class
notification.serializer.
UserNotificationSerializer
(instance=None, data=<class rest_framework.fields.empty>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
-
UserNotificationSerializer.
auto_created
= True¶
-
notification.views module¶
-
class
notification.views.
NotificationView
(**kwargs)[source]¶ Bases:
rest_framework.views.APIView
This class is an API for get specific notification.
-
get
(request)[source]¶ Get notification of specific user. :param request: Django Rest Framework request object. :param format: pattern for Web APIs.
Returns: list of notification of that user.
-
serializer_class
¶ alias of
GetNotificationSerializer
-
-
class
notification.views.
NotificationViewList
(**kwargs)[source]¶ Bases:
rest_framework.views.APIView
This class is an API for create and get all notification.
-
add
(user, data, receiver_set, type, link_item, reference_detail, format=None)[source]¶ Create and save notification to database. :param user: user who create notification. :param data: Json information of target of post :param receiver_set: set of receiver who will receive
this notification.Parameters: - type – type of action that create this notification.
- link_item – information of action that create this notification.
- reference_detail – information of the post target object
- format – pattern for Web APIs.
Return:
-
get
(request, format=None)[source]¶ Get all of notification in database. :param request: Django Rest Framework request object. :param format: pattern for Web APIs.
Returns: list of all notification in database.
-
serializer_class
¶ alias of
NotificationSerializer
-
-
class
notification.views.
UpdateNotification
(**kwargs)[source]¶ Bases:
rest_framework.views.APIView
This class is an API for update readed notification.
-
get
(request, noti_id, format=None)[source]¶ Get notification in database and mark as readed. :param request: Django Rest Framework request object. :param noti_id: id of notification. :param format: pattern for Web APIs.
Returns: updated notificaton.
-
get_object
(noti_id)[source]¶ Get notification object by id. :param noti_id: id of notification.
Returns: notification object.
-
serializer_class
¶ alias of
UpdateNotificationSerializer
-