| # Copyright 2014 the Melange authors. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| """This module contains the project related models.""" |
| |
| from google.appengine.ext import ndb |
| from google.appengine.ext.ndb import msgprop |
| |
| from melange.appengine import db as melange_db |
| |
| from protorpc import messages |
| |
| |
| class Status(messages.Enum): |
| """Class that enumerates possible statuses of proposals.""" |
| #: The project has been accepted to the program. |
| ACCEPTED = 1 |
| |
| #: The project has been failed, for example by failing one of the evaluations. |
| FAILED = 2 |
| |
| #: This project has been withdrawn and is no longer in the program. |
| WITHDRAWN = 3 |
| |
| |
| class Project(ndb.Model): |
| """Model that represents a project that is defined for a student whose |
| proposal is accepted into the program. |
| |
| Parent: |
| melange.models.profile.Profile (of the student who owns the project) |
| """ |
| |
| #: Required field indicating the title of the project. |
| title = ndb.StringProperty(required=True) |
| |
| #: Required field storing a short description of the project. |
| abstract = ndb.TextProperty(required=True) |
| |
| #: Required field storing all details of the project. |
| content = ndb.TextProperty() |
| |
| #: Optional field storing URL linking to additional resources |
| #: associated with the project. |
| additional_info = ndb.StringProperty(validator=melange_db.link_validator) |
| |
| #: Field telling whether the project can be featured on program home page. |
| is_featuring_allowed = ndb.BooleanProperty(default=False) |
| |
| #: List of mentors assigned for the proposal. |
| mentors = ndb.KeyProperty(repeated=True) |
| |
| #: Field storing status of the project. |
| status = msgprop.EnumProperty(Status, required=True) |
| |
| #: Field storing the proposal based on which the project was created. |
| proposal = ndb.KeyProperty(required=False) |
| |
| #: Field storing the organization for which the project belongs. |
| organization = ndb.KeyProperty(required=True) |
| |
| #: Field storing the program for which the project belongs. |
| program = ndb.KeyProperty(required=True) |
| |
| #: Field storing the evaluations which the project passed |
| passed_evaluations = ndb.KeyProperty(repeated=True) |
| |
| #: Field storing the evaluation which the project failed |
| failed_evaluation = ndb.KeyProperty() |
| |
| #: TODO(daniel): add code samples |