app/soc/models/documentation.py
author Sverre Rabbelier <srabbelier@gmail.com>
Fri, 13 Feb 2009 22:36:45 +0000
changeset 1307 091a21cf3627
parent 351 b37fc4c1e189
child 1308 35b75ffcbb37
permissions -rw-r--r--
Update the copyright notice for 2009. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/python2.5
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     2
#
1307
091a21cf3627 Update the copyright notice for 2009.
Sverre Rabbelier <srabbelier@gmail.com>
parents: 351
diff changeset
     3
# Copyright 2009 the Melange authors.
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     4
#
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     8
# 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    10
# 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    15
# limitations under the License.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    16
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    17
"""This module contains the Documentation Model."""
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    18
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    19
__authors__ = [
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    20
  '"Todd Larsen" <tlarsen@google.com>',
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    21
  '"Sverre Rabbelier" <sverre@rabbelier.nl>',
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    22
]
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    23
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    24
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
from google.appengine.ext import db
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    27
import soc.models.role
181
fdd29818a954 Remove Author model (use Person instead). Update models after removing Author. Add new Sponsor, Organization models.
Pawel Solyga <Pawel.Solyga@gmail.com>
parents: 54
diff changeset
    28
import soc.models.work
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    29
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    30
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    31
class Documentation(soc.models.work.Work):
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    32
  """Model of Documentation, which is a Work authored by Administrators.
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    33
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    34
  Documentation is items like tax forms, letters from schools confirming
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    35
  enrollment, etc., (often scanned in) that are attached to a Role as
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    36
  documentation related to that Role.
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    37
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    38
  The specific way that some properties and relations inherited from Work
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    39
  are used with a piece of Documentation are described below.
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    40
351
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    41
    work.title: The title of the Documentation (e.g. "Verification
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    42
      of Eligibility").
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    43
351
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    44
    work.author: The author of the Work referred to by this 
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    45
      relation is the Administrator (or Host) creating the
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    46
      Documentation.
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    47
351
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    48
    work.reviews: Annotations to the Documentation made by other
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    49
      Administrators.
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    50
351
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    51
    work.content: Summary of the contents of the 'attachment', or
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    52
      just an indication that the required documentation was 
b37fc4c1e189 Eliminate the Work.abstract property and move the Document.content property
Todd Larsen <tlarsen@google.com>
parents: 342
diff changeset
    53
      supplied but is not actually attached.
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    54
  """
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
  #: a many:1 relationship of Documentation entities that pertain
206
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    57
  #: to a single Role.  The back-reference in the Role model is a
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    58
  #: Query named 'documentation'.
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    59
  role = db.ReferenceProperty(reference_class=soc.models.role.Role,
832335761384 Make use of PolyModel for Works, Documents, etc. Add some (but not all) of
Todd Larsen <tlarsen@google.com>
parents: 181
diff changeset
    60
                              collection_name='documentation')
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    62
  #: An optional db.BlobProperty containing the documentation
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63
  #: (usually a scanned image of a paper document or a PDF file).
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    64
  attachment = db.BlobProperty()
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    65