app/ghop/models/task.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Mon, 01 Jun 2009 22:23:46 +0200
changeset 2376 feec28b50f1b
parent 2348 0edff67b472d
permissions -rw-r--r--
Extend taggable-mixin to support different Tag models. Usage is pretty simple. Tag model is default in Taggable constructor but you can call it with different model like GHOPTaskType that inherits from Tag model. Both Taggable and Tag models have been updated and they don't use hardcoded Tag model anymore and instead use cls of class methods or self.__class__. In case of Taggable it's self.__tag_model.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     2
#
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     3
# Copyright 2009 the Melange authors.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     4
#
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     8
#
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    10
#
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    16
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    17
"""This module contains the GHOP Task Model.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    18
"""
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    19
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    20
__authors__ = [
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    21
  '"Madhusudan.C.S" <madhusudancs@gmail.com>',
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    22
  '"Lennard de Rijk" <ljvderijk@gmail.com>',
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    23
]
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    24
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    25
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    26
from google.appengine.ext import db
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    27
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    28
from django.utils.translation import ugettext
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    29
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    30
import soc.models.linkable
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    31
import soc.models.role
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    32
import soc.models.student
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    33
import soc.models.user
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    34
2348
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
    35
import ghop.models.program
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    36
2348
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
    37
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
    38
class GHOPTask(soc.models.linkable.Linkable):
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    39
  """Model for a task used in GHOP workflow.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    40
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    41
  The scope property of Linkable will be set to the Organization to which
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    42
  this task belongs to. A link_id will be generated automatically and will
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    43
  have no specific meaning other than identification.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    44
  """
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    45
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    46
  #: Required field indicating the "title" of the task
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    47
  title = db.StringProperty(required=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    48
                            verbose_name=ugettext('Title'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    49
  title.help_text = ugettext('Title of the task')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    50
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    51
  #: Required field containing the description of the task
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    52
  description = db.TextProperty(required=True, 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    53
                                verbose_name=ugettext('Description'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    54
  description.help_text = ugettext('Complete description of the task')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    55
2348
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
    56
  #: Field indicating the difficulty level of the Task. This is not
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    57
  #: mandatory so the it can be assigned at any later stage. 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    58
  #: The options are configured by a Program Admin.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    59
  difficulty = db.StringProperty(required=False,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    60
                                 verbose_name=ugettext('Difficulty'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    61
  difficulty.help_text = ugettext('Difficulty Level of the task')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    62
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    63
  #: Required field which contains the type of the task. These types are
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    64
  #: configured by a Program Admin.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    65
  type = db.StringListProperty(required=True, 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    66
                               verbose_name=ugettext('Task Type'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    67
  type.help_text = ugettext('Type of the task')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    68
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    69
  #: A field which contains time allowed for completing the task (in hours)
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    70
  #: from the moment that this task has been assigned to a Student
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    71
  time_to_complete = db.IntegerProperty(required=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    72
                                        verbose_name=('Time to Complete'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    73
  time_to_complete.help_text = ugettext(
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    74
      'Time allowed to complete the task, in hours, once it is claimed')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    75
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    76
  #: List of Mentors assigned to this task. A Mentor who creates this
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    77
  #: task is assigned as the Mentor by default. An Org Admin will have
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    78
  #: to assign a Mentor upon task creation.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    79
  mentors = db.ListProperty(item_type=db.Key, default=[])
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    80
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    81
  #: User profile to whom this task has been claimed by. This field
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    82
  #: is mandatory for claimed tasks
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    83
  user = db.ReferenceProperty(reference_class=soc.models.user.User,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    84
                              required=False,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    85
                              collection_name='assigned_tasks')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    86
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    87
  #: Student profile to whom this task is currently assigned to. If the user
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    88
  #: has registered as a Student than this field will be filled in. This field
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    89
  #: is mandatory for all Tasks in the closed state.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    90
  student = db.ReferenceProperty(reference_class=soc.models.student.Student,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    91
                                 required=False,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    92
                                 collection_name='assigned_tasks')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    93
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    94
  #: Program in which this Task has been created
2348
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
    95
  program = db.ReferenceProperty(reference_class=ghop.models.program.GHOPProgram,
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    96
                                 required=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    97
                                 collection_name='tasks')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    98
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
    99
  #: Required property which holds the state, the Task is currently in.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   100
  #: This is a hidden field not shown on forms. Handled by logic internally.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   101
  #: The state can be one of the following:
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   102
  #: unapproved: If Task is created by a Mentor, this is the automatically
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   103
  #:   assigned state.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   104
  #: unpublished: This Task is not published yet.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   105
  #: open: This Task is open and ready to be claimed.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   106
  #: reopened: This Task has been claimed but never finished and has been
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   107
  #:   reopened.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   108
  #: claim_requested: A Student has requested to claim this task.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   109
  #: claimed: This Task has been claimed and someone is working on it.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   110
  #: action_needed: Work on this Task must be submitted for review within 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   111
  #:   24 hours.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   112
  #: closed: Work on this Task has been completed to the org's content.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   113
  #: awaiting_registration: Student has completed work on this task, but
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   114
  #:   needs to complete Student registration before this task is closed.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   115
  #: needs_work: This work on this Tasks needs a bit more brushing up. This
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   116
  #:   state is followed by a Mentor review.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   117
  #: needs_review: Student has submitted work for this task and it should
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   118
  #:   be reviewed by a Mentor.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   119
  status = db.StringProperty(
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   120
      required=True, verbose_name=ugettext('Status'),
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   121
      choices=['unapproved', 'unpublished', 'open', 'reopened', 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   122
               'claim_requested', 'claimed', 'action_needed', 
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   123
               'closed', 'awaiting_registration', 'needs_work',
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   124
               'needs_review'],
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   125
      default='unapproved')
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   126
2348
0edff67b472d Fixed model name and comment typo's in task model.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 2338
diff changeset
   127
  #: A field which indicates if the Task was ever in the Reopened state.
2338
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   128
  #: True indicates that its state was Reopened once, false indicated that it
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   129
  #: has never been in the Reopened state.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   130
  was_reopened = db.BooleanProperty(default=False,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   131
                                    verbose_name=ugettext('Has been reopened'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   132
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   133
  #: This field is set to the next deadline that will have consequences for
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   134
  #: this Task. For instance this will store a DateTime property which will
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   135
  #: tell when this Task should be completed.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   136
  deadline = db.DateTimeProperty(required=False,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   137
                                 verbose_name=ugettext('Deadline'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   138
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   139
  #: Required field containing the Mentor/Org Admin who created this task
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   140
  created_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   141
                                    required=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   142
                                    collection_name='created_tasks',
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   143
                                    verbose_name=ugettext('Created by'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   144
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   145
  #: Date when the proposal was created
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   146
  created_on = db.DateTimeProperty(required=True, auto_now_add=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   147
                                   verbose_name=ugettext('Created on'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   148
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   149
  #: Required field containing the Mentor/Org Admin who last edited this
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   150
  #: task. It changes only when Mentor/Org Admin changes title, description,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   151
  #: difficulty, type, time_to_complete.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   152
  modified_by = db.ReferenceProperty(reference_class=soc.models.role.Role,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   153
                                   required=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   154
                                   collection_name='edited_tasks',
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   155
                                   verbose_name=ugettext('Modified by'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   156
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   157
  #: Date when the proposal was last modified, should be set manually on edit
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   158
  modified_on = db.DateTimeProperty(required=True, auto_now_add=True,
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   159
                                    verbose_name=ugettext('Modified on'))
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   160
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   161
  #: A field which holds the entire history of this task in JSON. The
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   162
  #: structure of this JSON string is as follows:
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   163
  #: {
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   164
  #:    timestamp1: {
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   165
  #:                   "user": User reference
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   166
  #:                   "student": Student reference
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   167
  #:                   ...
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   168
  #:                   "state": "Unapproved"
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   169
  #:                   ...
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   170
  #:                   "edited_by": Role reference
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   171
  #:                   
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   172
  #:               }
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   173
  #:    timestamp2: {
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   174
  #:                   "state": "Unpublished"
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   175
  #:               }
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   176
  #: }
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   177
  #: First dictionary item holds the values for all the properties in this
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   178
  #: model. The subsequent items hold the properties that changed at the
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   179
  #: timestamp given by the key.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   180
  #: Reference properties will be stored by calling str() on their Key.
e57a6d9eea4b Added GHOP Task model.
Madhusudan C.S. <madhusudancs@gmail.com>
parents:
diff changeset
   181
  history = db.TextProperty(required=True, default='')