app/soc/modules/ghop/models/task.py
author Daniel Hans <Daniel.M.Hans@gmail.com>
Tue, 10 Nov 2009 18:18:06 +0100
changeset 3085 ded7a67e7e0a
parent 3084 cac43a6cb986
permissions -rw-r--r--
Some functions which applies to scoped tags in general moved from TaskTag to Task model. Also, some stylish and whitespace changes and docstrings added.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     2
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     4
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     8
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    10
#
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    16
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    17
"""This module contains the GHOP Task Model.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    18
"""
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    19
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    20
__authors__ = [
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    21
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    22
  '"Daniel Hans" <daniel.m.hans@gmail.com>',
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    24
]
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    25
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    26
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
from google.appengine.ext import db
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
from django.utils.translation import ugettext
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    31
from taggable.taggable import Tag
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    32
from taggable.taggable import Taggable
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    33
from taggable.taggable import tag_property
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    34
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    35
import soc.models.linkable
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    36
import soc.models.role
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    37
import soc.models.student
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    38
import soc.models.user
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    39
2407
e23fce20ad3a Changed GHOP module imports to be consistent with rest of Melange code.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2399
diff changeset
    40
import soc.modules.ghop.models.program
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
2703
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    42
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    43
class TaskTag(Tag):
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    44
  """Model for storing all Task tags.
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    45
  """
3082
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
    46
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    47
  order = db.IntegerProperty(required=True, default=0)
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    48
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    49
  @classmethod
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    50
  def get_by_scope(cls, scope):
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    51
    """Get the list of tag objects that has the given scope and sorts the
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    52
       result by order values.
2703
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    53
    """
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    54
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    55
    tags = db.Query(cls).filter('scope =', scope).order('order').fetch(1000)
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    56
    return tags
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    57
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    58
  @classmethod
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    59
  def get_highest_order(cls, scope):
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    60
    """Get a tag with highest order.
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    61
    """
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    62
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    63
    tag = db.Query(cls).filter('scope =', scope).order('-order').get()
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    64
    if tag:
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
    65
      return tag.order
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    66
    else:
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    67
      return -1
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    68
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    69
  @classmethod
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    70
  def update_order(cls, scope, tag_name, order):
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    71
    """Updates the order of the tag.
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    72
    """
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    73
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    74
    tag = cls.get_by_scope_and_name(scope, tag_name)
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    75
    if tag:
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    76
      tag.order = order
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    77
      tag.put()
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    78
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    79
    return tag
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    80
2703
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    81
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    82
class TaskTypeTag(TaskTag):
2703
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    83
  """Model for storing of task type tags.
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    84
  """
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    85
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    86
  pass
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    87
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    88
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    89
class TaskDifficultyTag(TaskTag):
2703
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    90
  """Model for storing of task difficulty level tags.
7117c43ccf1b Style fixes in the ghop task model module.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2679
diff changeset
    91
  """
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    92
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    93
  pass
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    94
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
    95
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    96
class TaskArbitraryTag(TaskTag):
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    97
  """Model for storing of arbitrary tags.
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    98
  """
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
    99
3082
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   100
  def __init__(self, *args, **kwds):
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   101
    """Initialization function.
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   102
    """
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   103
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   104
    TaskTag.__init__(self, *args, **kwds)
da8cc38cabe9 TaskArbritraryTag now has auto_delete set to True by default.
Daniel Hans <daniel.m.hans@gmail.com>
parents: 2858
diff changeset
   105
    self.auto_delete = True
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   106
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   107
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   108
class GHOPTask(Taggable, soc.models.linkable.Linkable):
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   109
  """Model for a task used in GHOP workflow.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   110
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   111
  The scope property of Linkable will be set to the Organization to which
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   112
  this task belongs to. A link_id will be generated automatically and will
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   113
  have no specific meaning other than identification.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   114
  """
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   115
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   116
  #: Required field indicating the "title" of the task
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   117
  title = db.StringProperty(required=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   118
                            verbose_name=ugettext('Title'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   119
  title.help_text = ugettext('Title of the task')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   120
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   121
  #: Required field containing the description of the task
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   122
  description = db.TextProperty(required=True,
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   123
                                verbose_name=ugettext('Description'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   124
  description.help_text = ugettext('Complete description of the task')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   125
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   126
  #: Field indicating the difficulty level of the Task. This is not
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   127
  #: mandatory so the it can be assigned at any later stage.
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   128
  #: The options are configured by a Program Admin.
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   129
  difficulty = tag_property('difficulty')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   130
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   131
  #: Required field which contains the type of the task. These types are
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   132
  #: configured by a Program Admin.
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   133
  task_type = tag_property('task_type')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   134
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   135
  #: Field which contains the arbitrary tags for the task. These tags can
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   136
  #: be assigned by Org Admins and mentors.
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   137
  arbit_tag = tag_property('arbit_tag')
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   138
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   139
  #: A field which contains time allowed for completing the task (in hours)
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   140
  #: from the moment that this task has been assigned to a Student
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   141
  time_to_complete = db.IntegerProperty(required=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   142
                                        verbose_name=('Time to Complete'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   143
  time_to_complete.help_text = ugettext(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   144
      'Time allowed to complete the task, in hours, once it is claimed')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   145
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   146
  #: List of Mentors assigned to this task. A Mentor who creates this
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   147
  #: task is assigned as the Mentor by default. An Org Admin will have
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   148
  #: to assign a Mentor upon task creation.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   149
  mentors = db.ListProperty(item_type=db.Key, default=[])
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   150
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   151
  #: User profile to whom this task has been claimed by. This field
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   152
  #: is mandatory for claimed tasks
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   153
  user = db.ReferenceProperty(reference_class=soc.models.user.User,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   154
                              required=False,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   155
                              collection_name='assigned_tasks')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   156
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   157
  #: Student profile to whom this task is currently assigned to. If the user
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   158
  #: has registered as a Student than this field will be filled in. This field
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   159
  #: is mandatory for all Tasks in the closed state.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   160
  student = db.ReferenceProperty(reference_class=soc.models.student.Student,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   161
                                 required=False,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   162
                                 collection_name='assigned_tasks')
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   163
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   164
  #: Program in which this Task has been created
2399
65a83ae32703 Changed imports in models to comply with recent GHOP code move.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2397
diff changeset
   165
  program = db.ReferenceProperty(
2407
e23fce20ad3a Changed GHOP module imports to be consistent with rest of Melange code.
Madhusudan C.S. <madhusudancs@gmail.com>
parents: 2399
diff changeset
   166
      reference_class=soc.modules.ghop.models.program.GHOPProgram,
2399
65a83ae32703 Changed imports in models to comply with recent GHOP code move.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2397
diff changeset
   167
      required=True, collection_name='tasks')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   168
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   169
  #: Required property which holds the state, the Task is currently in.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   170
  #: This is a hidden field not shown on forms. Handled by logic internally.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   171
  #: The state can be one of the following:
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   172
  #: Unapproved: If Task is created by a Mentor, this is the automatically
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   173
  #:   assigned state.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   174
  #: Unpublished: This Task is not published yet.
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   175
  #: Open: This Task is open and ready to be claimed.
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   176
  #: Reopened: This Task has been claimed but never finished and has been
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   177
  #:   reopened.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   178
  #: ClaimRequested: A Student has requested to claim this task.
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   179
  #: Claimed: This Task has been claimed and someone is working on it.
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   180
  #: ActionNeeded: Work on this Task must be submitted for review within
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   181
  #:   24 hours.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   182
  #: Closed: Work on this Task has been completed to the org's content.
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   183
  #: AwaitingRegistration: Student has completed work on this task, but
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   184
  #:   needs to complete Student registration before this task is closed.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   185
  #: NeedsWork: This work on this Tasks needs a bit more brushing up. This
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   186
  #:   state is followed by a Mentor review.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   187
  #: NeedsReview: Student has submitted work for this task and it should
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   188
  #:   be reviewed by a Mentor.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   189
  #: Invalid: The Task is deleted either by an Org Admin/Mentor
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   190
  status = db.StringProperty(
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   191
      required=True, verbose_name=ugettext('Status'),
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   192
      choices=['Unapproved', 'Unpublished', 'Open', 'Reopened',
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   193
               'ClaimRequested', 'Claimed', 'ActionNeeded',
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   194
               'Closed', 'AwaitingRegistration', 'NeedsWork',
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   195
               'NeedsReview', 'Invalid'],
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   196
      default='Unapproved')
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   197
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   198
  #: This field is set to the next deadline that will have consequences for
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   199
  #: this Task. For instance this will store a DateTime property which will
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   200
  #: tell when this Task should be completed.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   201
  deadline = db.DateTimeProperty(required=False,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   202
                                 verbose_name=ugettext('Deadline'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   203
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   204
  #: Required field containing the Mentor/Org Admin who created this task.
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   205
  #: If site developer has created the task, it is empty.
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   206
  created_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   207
                                    required=False,
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   208
                                    collection_name='created_tasks',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   209
                                    verbose_name=ugettext('Created by'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   210
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   211
  #: Date when the proposal was created
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   212
  created_on = db.DateTimeProperty(required=True, auto_now_add=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   213
                                   verbose_name=ugettext('Created on'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   214
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   215
  #: Required field containing the Mentor/Org Admin who last edited this
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   216
  #: task. It changes only when Mentor/Org Admin changes title, description,
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   217
  #: difficulty, task_type, time_to_complete. If site developer has modified
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   218
  #: the task, it is empty.
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   219
  modified_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   220
                                   required=False,
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   221
                                   collection_name='edited_tasks',
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   222
                                   verbose_name=ugettext('Modified by'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   223
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   224
  #: Date when the proposal was last modified, should be set manually on edit
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   225
  modified_on = db.DateTimeProperty(required=True, auto_now_add=True,
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   226
                                    verbose_name=ugettext('Modified on'))
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   227
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   228
  #: A field which holds the entire history of this task in JSON. The
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   229
  #: structure of this JSON string is as follows:
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   230
  #: {
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   231
  #:    timestamp1: {
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   232
  #:                   "user": User reference
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   233
  #:                   "student": Student reference
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   234
  #:                   ...
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   235
  #:                   "state": "Unapproved"
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   236
  #:                   ...
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   237
  #:                   "edited_by": Role reference
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   238
  #:
2397
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   239
  #:               }
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   240
  #:    timestamp2: {
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   241
  #:                   "state": "Unpublished"
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   242
  #:               }
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   243
  #: }
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   244
  #: First dictionary item holds the values for all the properties in this
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   245
  #: model. The subsequent items hold the properties that changed at the
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   246
  #: timestamp given by the key.
d943fa182fae Moved the GHOP module into the modules package.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   247
  #: Reference properties will be stored by calling str() on their Key.
2788
78d02dcd8eb0 Changed all status to start with Uppercase letters, made 3 properties required.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2703
diff changeset
   248
  history = db.TextProperty(required=False, default='')
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   249
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   250
  def __init__(self, parent=None, key_name=None,
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   251
               app=None, **entity_values):
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   252
    """Constructor for GHOPTask Model.
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   253
2679
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   254
    Args:
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   255
        See Google App Engine APIs.
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   256
    """
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   257
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   258
    # explicitly call the AppEngine datastore Model constructor
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   259
    db.Model.__init__(self, parent, key_name, app, **entity_values)
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   260
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   261
    # call the Taggable constructor to initialize the tags specified as
0ede2f3adbc1 Adds to Melange a tags framework based on taggable-mixin.
Madhusudan C.S <madhusudancs@gmail.com>
parents: 2407
diff changeset
   262
    # keyword arguments
3085
ded7a67e7e0a Some functions which applies to scoped tags in general moved from TaskTag to Task model.
Daniel Hans <Daniel.M.Hans@gmail.com>
parents: 3084
diff changeset
   263
    Taggable.__init__(self, task_type=TaskTypeTag,
2858
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   264
                      difficulty=TaskDifficultyTag,
9b59d89e6707 Added additional methods for TaskTag model and add arbit_tag type to GHOPTask.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 2788
diff changeset
   265
                      arbit_tag=TaskArbitraryTag)