Les messages privés (mp/
)¶
Module situé dans zds/mp/
.
Fichiers documentés :
Modèles (models.py
)¶
-
class
zds.mp.models.
PrivatePost
(*args, **kwargs)¶ A private post written by an user.
-
get_absolute_url
()¶ URL of a single PrivatePost object.
Retourne: PrivatePost object URL Type retourné: str
Check if the user given is the author of the message.
Paramètres: user – Potential author of the message. Retourne: true if the user is the author.
-
is_last_message
(private_topic=None)¶ Check if the current message is the last one of its private topic.
Paramètres: private_topic – Potential private topic of the message. Retourne: true if the current message is the last.
-
-
class
zds.mp.models.
PrivateTopic
(*args, **kwargs)¶ Topic private, containing private posts.
-
alone
()¶ Check if there just one participant in the conversation (PrivateTopic).
Retourne: True if there just one participant in PrivateTopic Type retourné: bool
-
first_post
()¶ Get the first answer in the PrivateTopic written by topic’s author, if exists.
Retourne: PrivateTopic object first answer (PrivatePost) Type retourné: PrivatePost object or None
-
first_unread_post
(user=None)¶ Get the first PrivatePost the user has unread.
Paramètres: user (User object) – The user is reading the PrivateTopic. If None, the current user is used. Retourne: first PrivatePost unread Type retourné: PrivatePost object or None
-
get_absolute_url
()¶ URL of a single PrivateTopic object.
Retourne: PrivateTopic object URL Type retourné: str
-
get_last_answer
()¶ Get the last answer in the PrivateTopic written by topic’s author, if exists.
Retourne: PrivateTopic object last answer (PrivatePost) Type retourné: PrivatePost object or None
-
get_post_count
()¶ Get the number of private posts in a single PrivateTopic object.
Retourne: number of post in PrivateTopic object Type retourné: int
Check if the user given is the author of the private topic.
Paramètres: user – User given. Retourne: true if the user is the author.
-
is_participant
(user)¶ Check if the user given is in participants or author of the private topic.
Paramètres: user – User given. Retourne: true if the user is in participants
-
is_unread
(user=None)¶ Check if an user has never read the current PrivateTopic.
Paramètres: user (User object) – an user as Django User object. If None, the current user is used. Retourne: True if the PrivateTopic was never read Type retourné: bool
-
last_read_post
(user=None)¶ Get the last PrivatePost the user has read.
Paramètres: user (User object) – The user is reading the PrivateTopic. If None, the current user is used. Retourne: last PrivatePost read Type retourné: PrivatePost object or None
-
slug
()¶ PrivateTopic doesn’t have a slug attribute of a private topic. To be compatible with older private topic, the slug is always re-calculate when we need one. :return: title slugify.
-
-
class
zds.mp.models.
PrivateTopicRead
(*args, **kwargs)¶ Small model which keeps track of the user viewing private topics.
It remembers the topic he looked and what was the last private Post at this time.
-
zds.mp.models.
is_privatetopic_unread
(privatetopic, user=None)¶ Check if a private topic has been read by an user since it last post was added.
Paramètres: - privatetopic (PrivateTopic object) – a PrivateTopic to check
- user (User object) – an user as Django User object. If None, the current user is used
Retourne: True if the PrivateTopic was never read
Type retourné:
Vues (views.py
)¶
-
class
zds.mp.views.
PrivatePostAnswer
(**kwargs)¶ Creates a post to answer on a MP.
-
model_quote
¶ alias de
PrivatePost
-
-
class
zds.mp.views.
PrivatePostEdit
(**kwargs)¶ Edits a post on a MP.
-
class
zds.mp.views.
PrivatePostList
(**kwargs)¶ Display a thread and its posts using a pager.
-
class
zds.mp.views.
PrivateTopicLeaveDetail
(**kwargs)¶ Leaves a MP.
-
class
zds.mp.views.
PrivateTopicLeaveList
(**kwargs)¶ Leaves a list of MP.
-
class
zds.mp.views.
PrivateTopicList
(**kwargs)¶ Displays the list of private topics of a member given.
-
class
zds.mp.views.
PrivateTopicNew
(**kwargs)¶ Creates a new MP.