def get_url_to(self): from pid.design.models import Design from pid.procedure.models import Procedure from pid.specification.models import Specification reference_object = self.get_reference_object_to() if reference_object.get_class_name() in [ Design.get_class_name(), Procedure.get_class_name(), Specification.get_class_name() ]: return reference_object.get_latest_revision_url() return reference_object.get_url()
def get_anomaly_modal(): form = CreateAnomalyForm(request.form) variables = { 'form': form, 'designs': [], 'vendor_parts': [], 'as_runs': [] } record_id = request.form.get('record_id', None) record_class = request.form.get('record_class', None) if record_id: if record_class == Design.get_class_name(): variables['designs'] = [Design.get_by_id(record_id)] form.affected.data = 'design' elif record_class == VendorPart.get_class_name(): variables['vendor_parts'] = [VendorPart.get_by_id(record_id)] form.affected.data = 'design' elif record_class == AsRun.get_class_name(): variables['as_runs'] = [AsRun.get_by_id(record_id)] form.affected.data = 'asrun' return render_template('anomaly/create_anomaly.html', **variables)