old_contents: # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
  # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
  # Created By: peter@reciprocitylabs.com
  # Maintained By: peter@reciprocitylabs.com
  
  """A module containing the implementation of the assessment template entity."""
  
  from ggrc import db
  from ggrc.models.mixins import Base, Titled, CustomAttributable
  from ggrc.models.reflection import PublishOnly
  from ggrc.models.relationship import Relatable
  from ggrc.models.types import JsonType
  
  
  class AssessmentTemplate(Base, Relatable, Titled,
                           CustomAttributable, db.Model):
    """A class representing the assessment template entity.
  
    An Assessment Template is a template that allows users for easier creation of
    multiple Assessments that are somewhat similar to each other, avoiding the
    need to repeatedly define the same set of properties for every new Assessment
    object.
    """
    __tablename__ = "assessment_templates"
  
    # the type of the object under assessment
    template_object_type = db.Column(db.String, nullable=True)
  
    # whether to use the control test plan as a procedure
    test_plan_procedure = db.Column(db.Boolean, nullable=False)
  
    # procedure description
    procedure_description = db.Column(db.Text, nullable=True)
  
    # the people that should be assigned by default to each assessment created
    # within the releated audit
    default_people = db.Column(JsonType, nullable=False)
  
    # labels to show to the user in the UI for various default people values
    DEFAULT_PEOPLE_LABELS = {
        "Object Owners": "Object Owners",
        "Audit Lead": "Audit Lead",
        "Auditors": "Auditors",
        "Primary Assessor": "Principal Assessor",
        "Secondary Assessors": "Secondary Assessors",
        "Primary Contact": "Primary Contact",
        "Secondary Contact": "Secondary Contact",
    }
  
    _title_uniqueness = False
  
    # REST properties
    _publish_attrs = [
        "template_object_type",
        "test_plan_procedure",
        "procedure_description",
        "default_people",
        PublishOnly("DEFAULT_PEOPLE_LABELS")
    ]
  
new_contents: # Copyright (C) 2016 Google Inc., authors, and contributors <see AUTHORS file>
  # Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
  # Created By: peter@reciprocitylabs.com
  # Maintained By: peter@reciprocitylabs.com
  
  """A module containing the implementation of the assessment template entity."""
  
  from ggrc import db
  from ggrc.models.mixins import Base
  from ggrc.models.mixins import Slugged
  from ggrc.models.mixins import Titled
  from ggrc.models.mixins import CustomAttributable
  from ggrc.models.reflection import PublishOnly
  from ggrc.models.relationship import Relatable
  from ggrc.models.types import JsonType
  
  
  class AssessmentTemplate(Slugged, Base, Relatable, Titled,
                           CustomAttributable, db.Model):
    """A class representing the assessment template entity.
  
    An Assessment Template is a template that allows users for easier creation of
    multiple Assessments that are somewhat similar to each other, avoiding the
    need to repeatedly define the same set of properties for every new Assessment
    object.
    """
    __tablename__ = "assessment_templates"
  
    # the type of the object under assessment
    template_object_type = db.Column(db.String, nullable=True)
  
    # whether to use the control test plan as a procedure
    test_plan_procedure = db.Column(db.Boolean, nullable=False)
  
    # procedure description
    procedure_description = db.Column(db.Text, nullable=True)
  
    # the people that should be assigned by default to each assessment created
    # within the releated audit
    default_people = db.Column(JsonType, nullable=False)
  
    # labels to show to the user in the UI for various default people values
    DEFAULT_PEOPLE_LABELS = {
        "Object Owners": "Object Owners",
        "Audit Lead": "Audit Lead",
        "Auditors": "Auditors",
        "Primary Assessor": "Principal Assessor",
        "Secondary Assessors": "Secondary Assessors",
        "Primary Contact": "Primary Contact",
        "Secondary Contact": "Secondary Contact",
    }
  
    _title_uniqueness = False
  
    # REST properties
    _publish_attrs = [
        "template_object_type",
        "test_plan_procedure",
        "procedure_description",
        "default_people",
        PublishOnly("DEFAULT_PEOPLE_LABELS")
    ]
  
    @classmethod
    def generate_slug_prefix_for(cls, obj):
      return "TEMPLATE"
  
subject: Add Slugged mixin to assessment template