Matchmaking¶
The matching
application adds support for so-called “matchmaking” of
mentors and mentees. This includes invitations to form matchmaking
relationships as represented by the mentoring.models.Relationship
model.
Models¶
-
class
matching.models.
Invitation
(*args, **kwargs)[source]¶ An invitation to form a mentoring relationship.
Invites are the mechanism where mentor/mentee relationships are created. The
clean()
method of this model is overridden to allow invites to be created by anyone but, in that case, they need to be the mentor or mentee of the invite. Users with the “add_invitation” permission can invite any two users to form a mentor/mentee relationship.Each invitation records who the mentor and mentee are to be and the user who created the invite. (This is useful to determine which of the mentors and mentees should actually be notified.) The creation date is also stored to allow for some form of automatic expiry.
An “active” invite is one which is not expired and is still awaiting a response from the mentor or mentee. An invitation which is declined by either mentor or mentee should be marked as inactive even if the other party has not responded.
The
deactivated_on
date records when this invite became inactive either through being declined by one party, accepted by both or manually deactivated.Should the invite result in a new relationship, this is recorded in the
created_relationship
field.-
RESPONSES
= (('A', 'Accept'), ('D', 'Decline'))¶ The possible responses to an invitation.
-
clean
()[source]¶ Extra validation for invitations.
Creating invitations when the creator is not the mentor or mentee requires that the creator have the “add_invitation” permission.
-
created_by
¶ The User who created this invitation
-
created_on
= None¶ The date this invitation was created
-
created_relationship
¶ If this invite lead to a mentoring relationship, it is recorded here
-
deactivate
()[source]¶ Deactivate this invite without creating a relationship.
Does nothing if the invite is already deactivated.
-
deactivated_on
= None¶ If inactive, when did this invite become so
-
is_active
()[source]¶ Returns True iff the invite is active (i.e. the “deactivated_on” date is blank).
-
mentee
¶ The proposed mentee for this relationship
-
mentee_response
= None¶ The response from the mentee to the invite
-
mentor
¶ The proposed mentor for this relationship
-
mentor_response
= None¶ The response from the mentor to the invite
-
-
class
matching.models.
InvitationManager
[source]¶ Model manager for
Invitation
model.
Forms¶
-
class
matching.forms.
InvitationResponseForm
(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None)[source]¶ A form for responding to an invitation.
Validates that the user responding to the invitation is one of the mentor or the mentee and that the invitation is active.
Example:
invitation = # ... Retrieve Invitation instance f = InvitationResponseForm( data={'user': request.user.id, 'response': Invitation.ACCEPT}, instance=invitation ) f.save()
-
response
= None¶ The response. One of
Invitation.ACCEPT
orInvitation.DECLINE
-
user
= None¶ The database primary key for the user responding to the invitation.
-