def shipment_display(self, obj): for related_name in ( 'shipment_from', 'shipment_to', 'shipment_dest', 'shipment_bill', ): try: shipment = getattr(obj, related_name) return object_detail_admin_link(shipment) except AttributeError: continue return None
def job_id(self, obj): return object_detail_admin_link(obj)
def route_link(self, obj): return object_detail_admin_link(obj.routeleg.route)
def shipment_link(self, obj): return object_detail_admin_link(obj.shipment)