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), Column('image_id', db.BigInteger, db.ForeignKey('images.id'), primary_key=True)
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'), primary_key=True))
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'), primary_key=True))
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)) ecos_images = db.Table( 'ecos_images',
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') summary = Column(db.String)