app/soc/modules/ghop/models/comment.py
changeset 2789 259ce59acaf7
parent 2397 d943fa182fae
child 2822 387a3b80df05
equal deleted inserted replaced
2788:78d02dcd8eb0 2789:259ce59acaf7
    24 
    24 
    25 from google.appengine.ext import db
    25 from google.appengine.ext import db
    26 
    26 
    27 from django.utils.translation import ugettext
    27 from django.utils.translation import ugettext
    28 
    28 
    29 import soc.models.comment
    29 import soc.models.base
       
    30 
       
    31 import soc.modules.ghop.models.task
    30 
    32 
    31 
    33 
    32 class GHOPComment(soc.models.comment.Comment):
    34 class GHOPComment(soc.models.base.ModelWithFieldAttributes):
    33   """GHOP Comment model for tasks, extends the basic Comment model.
    35   """GHOP Comment model for tasks, extends the basic Comment model.
    34   """
    36   """
       
    37 
       
    38   #: The rich textual content of this comment
       
    39   content = db.TextProperty(required=False, verbose_name=ugettext('Content'))
    35 
    40 
    36   #: Property containing the human readable string that should be
    41   #: Property containing the human readable string that should be
    37   #: shown for the comment when something in the task changes, 
    42   #: shown for the comment when something in the task changes, 
    38   #: code.google.com issue tracker style
    43   #: code.google.com issue tracker style
    39   change_in_task = db.StringProperty(required=True,
    44   changes = db.StringListProperty(required=True, default=[],
    40       verbose_name=ugettext('Changes in the task'))
    45                                   verbose_name=ugettext('Changes in the task'))
       
    46 
       
    47   #: Property storing the status of the comment.
       
    48   #: valid: comment is visible to all
       
    49   #: invalid: comment is deleted, which is marked as invalid
       
    50   status = db.StringProperty(default='valid',
       
    51                              choices=['valid','invalid'],
       
    52                              verbose_name=ugettext('Status of this Comment'))
       
    53 
       
    54   #: Reference property to the task entity under which the comment
       
    55   #: is scoped 
       
    56   scope = db.ReferenceProperty(
       
    57       reference_class=soc.modules.ghop.models.task.GHOPTask,
       
    58       required=True, collection_name='comment_scopes',
       
    59       verbose_name=ugettext('Comment Scope'))
       
    60   scope.help_text = ugettext(
       
    61       'Reference to the task entity under which this comment was posted.')
       
    62 
       
    63   #: Hidden (not displayed to users or editable in forms) cache of the string
       
    64   #: representation of the transitive closure of scopes, for use in URLs.
       
    65   scope_path = db.StringProperty(required=False,
       
    66                                  verbose_name=ugettext('Scope path'))
       
    67   scope_path.help_text = ugettext(
       
    68       'Cache of the string form of the entity scope.')
       
    69 
       
    70   #: A required many:1 relationship with a comment entity indicating
       
    71   #: the user who provided that comment.
       
    72   created_by = db.ReferenceProperty(reference_class=soc.models.user.User,
       
    73                                     required=True,
       
    74                                     collection_name="commented_by")
       
    75 
       
    76   #: Date when the comment was added
       
    77   created_on = db.DateTimeProperty(auto_now_add=True)
       
    78 
       
    79   # indicating wich user last modified the work. Used in displaying Work
       
    80   modified_by = db.ReferenceProperty(reference_class=soc.models.user.User,
       
    81                                      required=False,
       
    82                                      collection_name="comment_modified_by",
       
    83                                      verbose_name=ugettext('Modified by'))
       
    84 
       
    85   #: date when the work was last modified
       
    86   modified_on = db.DateTimeProperty(auto_now=True)