app/soc/models/documentation.py
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sun, 21 Sep 2008 08:59:11 +0000
changeset 183 37d98c3cefa5
parent 181 fdd29818a954
child 206 832335761384
permissions -rw-r--r--
Small change to unescape function in template_helpers (move replace('&amp;', '&') at the end).
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
#
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
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
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    24
from google.appengine.ext import db
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    25
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    26
from soc import models
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    27
import soc.models.person
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
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    30
class Documentation(db.Model):
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    31
  """Model of Documentation, which is a Work authored by Administrators."""
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    32
    
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    33
  #: A required 1:1 relationship with a Work entity that contains the
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    34
  #: general "work" properties of the Documentation. The 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    35
  #: back-reference in the Work model is a Query named 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    36
  #: 'documentation'.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    37
  #:
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    38
  #:   work.authors: The Authors of the Work referred to by this 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    39
  #:     relation are the Administrators (or Hosts) creating the
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    40
  #:     Documentation.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    41
  #:
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    42
  #:   work.title: The title of the Documentation (e.g. "Verification
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    43
  #:     of Eligibility").
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    44
  #:
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    45
  #:   work.abstract: Summary of the contents of the 'attachment', or
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    46
  #:     just an indication that the required documentation was 
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    47
  #:     supplied but is not actually attached.
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    48
  #:
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    49
  #:   work.reviews: Annotations to the Documentation made by other
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    50
  #:     Administrators.
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
    51
  work = db.ReferenceProperty(reference_class=models.work.Work, required=True,
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    52
                              collection_name="proposal")
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    53
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    54
  #: a many:1 relationship of Documentation entities that pertain
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    55
  #: to a single Person.  The back-reference in the Person model is a
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    56
  #: Query named 'docs'.
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
    57
  person = db.ReferenceProperty(reference_class=models.person.Person,
21
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    58
                                collection_name="docs")
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    59
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    60
  #: An optional db.BlobProperty containing the documentation
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    61
  #: (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
    62
  attachment = db.BlobProperty()
6edf98d9c739 Initial definition of the Documentation Model.
Sverre Rabbelier <srabbelier@gmail.com>
parents:
diff changeset
    63