Exemplo n.º 1
0
    def get_descriptive_url(self):
        return '<a href="{0}">{1} - {2}</a>'.format(
            self.get_url(), self.get_unique_identifier(), self.get_name())

    def __str__(self):
        return str(self.id)

    def __repr__(self):
        return '<Task({0})>'.format(self.id)


tasks_documents = db.Table(
    'tasks_documents',
    Column('task_id',
           db.BigInteger,
           db.ForeignKey('tasks.id'),
           primary_key=True),
    Column('document_id',
           db.BigInteger,
           db.ForeignKey('documents.id'),
           primary_key=True))

tasks_images = db.Table(
    'tasks_images',
    Column('task_id',
           db.BigInteger,
           db.ForeignKey('tasks.id'),
           primary_key=True),
    Column('image_id',
           db.BigInteger,
           db.ForeignKey('images.id'),
Exemplo n.º 2
0
        return self.name if self.name else self.procedure.name

    def get_unique_identifier(self):
        return '{0}-{1}'.format(self.procedure.procedure_number, str(self.as_run_number).zfill(3))

    def get_url(self, external=False):
        return url_for('asrun.view_as_run', procedure_number=self.procedure.procedure_number,
                       as_run_number=self.as_run_number, _external=external)

    def __repr__(self):
        """Represent instance as a unique string."""
        return '<AsRun({id!r},{as_run_number!r})>'.format(id=self.id, as_run_number=self.as_run_number)


as_runs_anomalies = db.Table('as_runs_anomalies',
    Column('as_run_id', db.BigInteger, db.ForeignKey('as_runs.id'), primary_key=True),
    Column('anomaly_id', db.BigInteger, db.ForeignKey('anomalies.id'), primary_key=True)
)

as_runs_approvers = db.Table('as_runs_approvers',
    Column('as_run_id', db.BigInteger, db.ForeignKey('as_runs.id'), primary_key=True),
    Column('approver_id', db.BigInteger, db.ForeignKey('approvers.id'), primary_key=True)
)

as_runs_documents = db.Table('as_runs_documents',
    Column('as_run_id', db.BigInteger, db.ForeignKey('as_runs.id'), primary_key=True),
    Column('document_id', db.BigInteger, db.ForeignKey('documents.id'), primary_key=True)
)

as_runs_images = db.Table('as_runs_images',
    Column('as_run_id', db.BigInteger, db.ForeignKey('as_runs.id'), primary_key=True),
Exemplo n.º 3
0
        return approval_errors

    def get_unique_identifier(self):
        return self.key

    def get_url(self, external=False):
        return url_for('eco.view_eco', key=self.key, _external=external)

    def __repr__(self):
        """Represent instance as a unique string."""
        return '<ECO({id!r},{key!r})>'.format(id=self.id, key=self.key)


ecos_approvers = db.Table(
    'ecos_approvers',
    Column('eco_id', db.BigInteger, db.ForeignKey('ecos.id'),
           primary_key=True),
    Column('approver_id',
           db.BigInteger,
           db.ForeignKey('approvers.id'),
           primary_key=True))

ecos_documents = db.Table(
    'ecos_documents',
    Column('eco_id', db.BigInteger, db.ForeignKey('ecos.id'),
           primary_key=True),
    Column('document_id',
           db.BigInteger,
           db.ForeignKey('documents.id'),
           primary_key=True))
Exemplo n.º 4
0
    def find_all_as_runs(self):
        from pid.asrun.models import AsRun
        return AsRun.query.filter_by(
            procedure_number=self.procedure_number).all()

    def __repr__(self):
        """Represent instance as a unique string."""
        return '<Procedure({id!r},{procedure_number!r})>'.format(
            id=self.id, procedure_number=self.procedure_number)


procedures_approvers = db.Table(
    'procedures_approvers',
    Column('procedure_id',
           db.BigInteger,
           db.ForeignKey('procedures.id'),
           primary_key=True),
    Column('approver_id',
           db.BigInteger,
           db.ForeignKey('approvers.id'),
           primary_key=True))

procedures_documents = db.Table(
    'procedures_documents',
    Column('procedure_id',
           db.BigInteger,
           db.ForeignKey('procedures.id'),
           primary_key=True),
    Column('document_id',
           db.BigInteger,
           db.ForeignKey('documents.id'),
Exemplo n.º 5
0
        return url_for('specification.view_specification',
                       specification_number=self.specification_number,
                       revision=self.revision,
                       _external=external)

    def __repr__(self):
        """Represent instance as a unique string."""
        return '<Specification({id!r},{specification_number!r})>'.format(
            id=self.id, specification_number=self.specification_number)


specifications_approvers = db.Table(
    'specifications_approvers',
    Column('specification_id',
           db.BigInteger,
           db.ForeignKey('specifications.id'),
           primary_key=True),
    Column('approver_id',
           db.BigInteger,
           db.ForeignKey('approvers.id'),
           primary_key=True))

specifications_documents = db.Table(
    'specifications_documents',
    Column('specification_id',
           db.BigInteger,
           db.ForeignKey('specifications.id'),
           primary_key=True),
    Column('document_id',
           db.BigInteger,
           db.ForeignKey('documents.id'),
Exemplo n.º 6
0
        if current_user == self.owner:
            role = 'owner'
        elif current_user.is_superuser():
            role = 'superuser'
        state = 'open'
        return self.permissions.get_permissions().get(state, False).get(role, False).get(field_name)

    def __str__(self):
        return self.build_number

    def __repr__(self):
        return '<VendorBuild({0})>'.format(self.build_number)


vendor_builds_discrepancies = db.Table('vendor_builds_discrepancies',
    Column('vendor_build_id', db.BigInteger, db.ForeignKey('vendor_builds.id'), primary_key=True),
    Column('discrepancy_id', db.BigInteger, db.ForeignKey('discrepancies.id'), primary_key=True)
)

vendor_builds_documents = db.Table('vendor_builds_documents',
    Column('vendor_build_id', db.BigInteger, db.ForeignKey('vendor_builds.id'), primary_key=True),
    Column('document_id', db.BigInteger, db.ForeignKey('documents.id'), primary_key=True)
)


class VendorProduct(NamelessRecord):
    __tablename__ = 'vendor_products'
    descriptor = 'Vendor Product'
    serial_number = Column(db.String, nullable=False)
    vendor_part_id = reference_col('vendor_parts')
    vendor_part = relationship('VendorPart')
Exemplo n.º 7
0
        return '{0}-{1}'.format(self.design_number, self.revision)

    def get_url(self, external=False):
        return url_for('design.view_design', design_number=self.design_number,
                       revision=self.revision, _external=external)

    def __str__(self):
        return '{0}-{1}'.format(self.design_number, self.revision)

    def __repr__(self):
        """Represent instance as a unique string."""
        return '<Design({0} {1})>'.format(self.design_number, self.revision)


designs_anomalies = db.Table('designs_anomalies',
    Column('design_id', db.BigInteger, db.ForeignKey('designs.id'), primary_key=True),
    Column('anomaly_id', db.BigInteger, db.ForeignKey('anomalies.id'), primary_key=True)
)

designs_approvers = db.Table('designs_approvers',
    Column('design_id', db.BigInteger, db.ForeignKey('designs.id'), primary_key=True),
    Column('approver_id', db.BigInteger, db.ForeignKey('approvers.id'), primary_key=True)
)

designs_documents = db.Table('designs_documents',
    Column('design_id', db.BigInteger, db.ForeignKey('designs.id'), primary_key=True),
    Column('document_id', db.BigInteger, db.ForeignKey('documents.id'), primary_key=True)
)

designs_ecos = db.Table('designs_ecos',
    Column('design_id', db.BigInteger, db.ForeignKey('designs.id'), primary_key=True),