3 # Copyright 2008 the Melange authors.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 """This module contains the comment Model."""
20 '"Matthew Wilkes" <matthew@matthewwilkes.co.uk>',
23 from google
.appengine
.ext
import db
25 import soc
.models
.work
26 import soc
.models
.user
27 import soc
.models
.linkable
30 from django
.utils
.translation
import ugettext
as _
33 class Comment(soc
.models
.linkable
.Linkable
):
34 """Model of a comment on a work.
36 A comment is usually associated with a Work or a Proposal,
37 for example a Document or a Student Proposal, and with a user, the author.
38 There are two types of comment, public (i.e. visible to the student),
39 or private (i.e. visible to programme/club staff). Neither type are
40 visible to people who are not connected to the work being commented on.
43 #: A required many:1 relationship with a comment entity indicating
44 #: the user who provided that comment.
45 author
= db
.ReferenceProperty(reference_class
=soc
.models
.user
.User
,
46 required
=True, collection_name
="commented")
48 #: The rich textual content of this comment
49 content
= db
.TextProperty(verbose_name
=_('Content'))
51 #: Indicated if the comment should be visible to the appropriate student
52 is_public
= db
.BooleanProperty(verbose_name
=_('Public comment'))
54 #: Date when the comment was added
55 created
= db
.DateTimeProperty(auto_now_add
=True)
57 #: date when the work was last modified
58 modified
= db
.DateTimeProperty(auto_now
=True)
60 # indicating wich user last modified the work. Used in displaying Work
61 modified_by
= db
.ReferenceProperty(reference_class
=soc
.models
.user
.User
,
63 collection_name
="modified_comments",
64 verbose_name
=_('Modified by'))