Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
db.Integer,
primary_key=True
)
#: The event the image belongs to
event_id = db.Column(
db.Integer,
db.ForeignKey('events.events.id'),
nullable=False,
index=True
)
event = db.relationship(
'Event',
lazy=False,
backref=db.backref(
'layout_images',
lazy='dynamic'
)
)
# relationship backrefs:
# - legacy_mapping (LegacyImageMapping.image)
@property
def locator(self):
return dict(self.event.locator, image_id=self.id, filename=self.filename)
def _build_storage_path(self):
path_segments = ['event', strict_unicode(self.event.id), 'images']
self.assign_id()
filename = '{}-{}'.format(self.id, self.filename)
db.ForeignKey('roombooking.equipment_types.id')
)
name = db.Column(
db.String,
nullable=False,
index=True
)
location_id = db.Column(
db.Integer,
db.ForeignKey('roombooking.locations.id'),
nullable=False
)
children = db.relationship(
'EquipmentType',
backref=db.backref(
'parent',
remote_side=[id]
)
)
# relationship backrefs:
# - location (Location.equipment_types)
# - parent (EquipmentType.children)
# - reservations (Reservation.used_equipment)
# - rooms (Room.available_equipment)
@return_ascii
def __repr__(self):
return u''.format(self.id, self.name, self.location_id)
return auto_table_args(cls, schema='attachments')
material_id = db.Column(
db.String,
nullable=False
)
folder_id = db.Column(
db.Integer,
db.ForeignKey('attachments.folders.id'),
primary_key=True,
autoincrement=False
)
folder = db.relationship(
'AttachmentFolder',
lazy=False,
backref=db.backref('legacy_mapping', uselist=False, lazy=True)
)
@return_ascii
def __repr__(self):
return ''.format(
self.folder, self.material_id, self.link_repr
)
class LegacyAttachmentMapping(_LegacyLinkMixin, db.Model):
"""Legacy attachment id mapping
Legacy attachments ("resources") had ids unique only within their
folder and its linked object. This table maps those ids for a
specific object to the new globally unique attachment id.
"""
index=True
)
event = db.relationship(
'Event',
lazy=True,
backref=db.backref(
'legacy_subcontribution_mappings',
cascade='all, delete-orphan',
lazy='dynamic'
)
)
subcontribution = db.relationship(
'SubContribution',
lazy=False,
backref=db.backref(
'legacy_mapping',
cascade='all, delete-orphan',
uselist=False,
lazy=True
)
)
@return_ascii
def __repr__(self):
return format_repr(self, 'event_id', 'legacy_contribution_id', 'legacy_subcontribution_id',
'subcontribution_id')
def all_files(cls):
return db.relationship(
cls.stored_file_class,
primaryjoin=lambda: cls.id == getattr(cls.stored_file_class, cls.stored_file_fkey),
foreign_keys=lambda: getattr(cls.stored_file_class, cls.stored_file_fkey),
lazy=True,
cascade='all, delete, delete-orphan',
order_by=lambda: cls.stored_file_class.created_dt.desc(),
backref=db.backref(
getattr(cls.stored_file_class, 'version_of'),
lazy=False
)
)
is_clonable = db.Column(
db.Boolean,
nullable=False,
default=True
)
is_system_template = db.Column(
db.Boolean,
nullable=False,
default=False
)
category = db.relationship(
'Category',
lazy=True,
foreign_keys=category_id,
backref=db.backref(
'designer_templates',
cascade='all, delete-orphan',
lazy=True
)
)
event = db.relationship(
'Event',
lazy=True,
backref=db.backref(
'designer_templates',
cascade='all, delete-orphan',
lazy=True
)
)
background_image = db.relationship(
'DesignerImageFile',
def own_venue(cls):
return db.relationship(
'Location',
foreign_keys=[cls.own_venue_id],
lazy=True,
backref=db.backref(
cls.location_backref_name,
lazy='dynamic'
)
primaryjoin='RegistrationFormItem.id == RegistrationFormFieldData.field_id',
foreign_keys='RegistrationFormFieldData.field_id',
lazy=True,
cascade='all, delete-orphan',
backref=db.backref(
'field',
lazy=False
)
)
# The children of the item and the parent backref
children = db.relationship(
'RegistrationFormItem',
lazy=True,
order_by='RegistrationFormItem.position',
backref=db.backref(
'parent',
lazy=False,
remote_side=[id]
)
)
# relationship backrefs:
# - parent (RegistrationFormItem.children)
# - registration_form (RegistrationForm.form_items)
@property
def view_data(self):
"""Returns object with data that Angular can understand"""
return dict(id=self.id, description=self.description, position=self.position)
@hybrid_property
)
is_ignored = db.Column(
db.Boolean,
nullable=False,
default=False
)
score = db.Column(
db.Float,
nullable=False,
default=0
)
category = db.relationship(
'Category',
lazy=False,
backref=db.backref(
'suggestions',
lazy=True,
cascade='all, delete-orphan'
)
)
# relationship backrefs:
# - user (User.suggested_categories)
@return_ascii
def __repr__(self):
return format_repr(self, 'user_id', 'category_id', 'score', is_ignored=False)
@classmethod
def merge_users(cls, target, source):
"""Merge the suggestions for two users.
def event(cls):
return db.relationship(
'Event',
lazy=True,
backref=db.backref(
cls.settings_backref_name,
lazy='dynamic'
)