How to use the indico.core.db.db.Column function in indico

To help you get started, weโ€™ve selected a few indico examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github indico / indico / indico / modules / attachments / models / folders.py View on Github external
    @strict_classproperty
    @staticmethod
    def __auto_table_args():
        default_inheriting = 'not (is_default and protection_mode != {})'.format(ProtectionMode.inheriting.value)
        return (db.CheckConstraint(default_inheriting, 'default_inheriting'),
                db.CheckConstraint('is_default = (title IS NULL)', 'default_or_title'),
                db.CheckConstraint('not (is_default and is_deleted)', 'default_not_deleted'),
                db.CheckConstraint('not (is_hidden and is_always_visible)', 'is_hidden_not_is_always_visible'),
                {'schema': 'attachments'})

    @declared_attr
    def __table_args__(cls):
        return auto_table_args(cls)

    #: The ID of the folder
    id = db.Column(
        db.Integer,
        primary_key=True
    )
    #: The name of the folder (``None`` for the default folder)
    title = db.Column(
        db.String,
        nullable=True
    )
    #: The description of the folder
    description = db.Column(
        db.Text,
        nullable=False,
        default=''
    )
    #: If the folder has been deleted
    is_deleted = db.Column(
github indico / indico / indico / modules / users / models / links.py View on Github external
id = db.Column(
        db.Integer,
        primary_key=True
    )
    user_id = db.Column(
        db.Integer,
        db.ForeignKey('users.users.id'),
        nullable=False,
        index=True
    )
    type = db.Column(
        db.String,
        nullable=False
    )
    role = db.Column(
        db.String,
        nullable=False
    )
    data = db.Column(
        JSON,
        nullable=False
    )
    # relationship backrefs:
    # - user (User.linked_objects)

    @return_ascii
    def __repr__(self):
        return ''.format(self.id, self.user_id, self.type, self.role, self.data)

    @cached_property
    def object(self):
github indico / indico / indico / modules / events / editing / models / tags.py View on Github external
# - revisions (EditingRevision.tags)

    @property
    def verbose_title(self):
        """Properly formatted title, including tag code."""
        return '{}: {}'.format(self.code, self.title)

    @return_ascii
    def __repr__(self):
        return format_repr(self, 'id', 'event_id', system=False, _text=self.title)


db.Table(
    'revision_tags',
    db.metadata,
    db.Column(
        'revision_id',
        db.ForeignKey('event_editing.revisions.id'),
        primary_key=True,
        autoincrement=False,
        index=True
    ),
    db.Column(
        'tag_id',
        db.ForeignKey('event_editing.tags.id'),
        primary_key=True,
        autoincrement=False,
        index=True
    ),
    schema='event_editing'
)
github indico / indico / indico / modules / rb / models / reservation_occurrences.py View on Github external
db.ForeignKey('roombooking.reservations.id'),
        nullable=False,
        primary_key=True
    )
    start_dt = db.Column(
        db.DateTime,
        nullable=False,
        primary_key=True,
        index=True
    )
    end_dt = db.Column(
        db.DateTime,
        nullable=False,
        index=True
    )
    notification_sent = db.Column(
        db.Boolean,
        nullable=False,
        default=False
    )
    state = db.Column(
        PyIntEnum(ReservationOccurrenceState),
        nullable=False,
        default=ReservationOccurrenceState.valid
    )
    rejection_reason = db.Column(
        db.String,
        nullable=True
    )

    # relationship backrefs:
    # - reservation (Reservation.occurrences)
github indico / indico / indico / modules / rb / models / reservation_excluded_days.py View on Github external
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Indico;if not, see .

"""
Dates to skip in a reservation
"""

from indico.core.db import db


class ReservationExcludedDay(db.Model):
    __tablename__ = 'reservation_excluded_days'

    excluded_day = db.Column(
        db.Date,
        nullable=False,
        primary_key=True
    )

    reservation_id = db.Column(
        db.Integer,
        db.ForeignKey('reservations.id'),
        nullable=False,
        primary_key=True
    )

    def __repr__(self):
        return ''.format(
            self.reservation_id,
            self.excluded_day
github indico / indico / indico / modules / events / registration / models / forms.py View on Github external
default=False
    )
    #: Whether users must be logged in to register
    require_login = db.Column(
        db.Boolean,
        nullable=False,
        default=True
    )
    #: Whether registrations must be associated with an Indico account
    require_user = db.Column(
        db.Boolean,
        nullable=False,
        default=True
    )
    #: Maximum number of registrations allowed
    registration_limit = db.Column(
        db.Integer,
        nullable=True
    )
    #: Whether registrations must be approved by a manager
    moderation_enabled = db.Column(
        db.Boolean,
        nullable=False,
        default=False
    )
    #: Whether the notifications for this event are enabled
    notifications_enabled = db.Column(
        db.Boolean,
        nullable=False,
        default=False
    )
    #: List of emails that should be notified on specific events
github indico / indico / indico / modules / events / agreements / models / agreements.py View on Github external
accepted = 1
    rejected = 2
    #: agreement accepted on behalf of the person
    accepted_on_behalf = 3
    #: agreement rejected on behalf of the person
    rejected_on_behalf = 4


class Agreement(db.Model):
    """Agreements between a person and Indico"""
    __tablename__ = 'agreements'
    __table_args__ = (db.UniqueConstraint('event_id', 'type', 'identifier'),
                      {'schema': 'events'})

    #: Entry ID
    id = db.Column(
        db.Integer,
        primary_key=True
    )
    #: Entry universally unique ID
    uuid = db.Column(
        db.String,
        nullable=False
    )
    #: ID of the event
    event_id = db.Column(
        db.Integer,
        db.ForeignKey('events.events.id'),
        nullable=False,
        index=True
    )
    #: Type of agreement
github indico / indico / indico_zodbimport / modules / event_regforms.py View on Github external
}[input.__class__.__name__]


class OldPaymentTransaction(db.Model):
    __tablename__ = 'payment_transactions_old'
    __table_args__ = {'schema': 'events'}

    id = db.Column(db.Integer, primary_key=True)
    event_id = db.Column(db.Integer)
    registrant_id = db.Column(db.Integer)
    status = db.Column(PyIntEnum(TransactionStatus))
    amount = db.Column(db.Numeric(8, 2))
    currency = db.Column(db.String)
    provider = db.Column(db.String)
    timestamp = db.Column(UTCDateTime)
    data = db.Column(JSON)

    def __repr__(self):
        return format_repr(self, 'id', 'registrant_id', 'status', 'provider', 'amount', 'currency', 'timestamp')


class RegformMigration(object):
    def __init__(self, importer, event, old_regform):
        self.importer = importer
        self.event = event
        self.old_regform = old_regform
        self.regform = None
        self.transactions = defaultdict(list)
        self.section_map = {}
        self.field_map = {}
        self.status_map = {}
        self.emails = set()
github indico / indico / indico / modules / rb / models / map_areas.py View on Github external
nullable=False
    )
    is_default = db.Column(
        db.Boolean,
        nullable=False,
        default=False
    )
    top_left_latitude = db.Column(
        db.Float,
        nullable=False
    )
    top_left_longitude = db.Column(
        db.Float,
        nullable=False
    )
    bottom_right_latitude = db.Column(
        db.Float,
        nullable=False
    )
    bottom_right_longitude = db.Column(
        db.Float,
        nullable=False
    )

    @return_ascii
    def __repr__(self):
        return format_repr(self, 'id', 'name', is_default=False)
github indico / indico / indico / modules / rb / models / holidays.py View on Github external
__table_args__ = (db.UniqueConstraint('date', 'location_id'),
                      {'schema': 'roombooking'})

    id = db.Column(
        db.Integer,
        primary_key=True
    )
    date = db.Column(
        db.Date,
        nullable=False,
        index=True
    )
    name = db.Column(
        db.String
    )
    location_id = db.Column(
        db.Integer,
        db.ForeignKey('roombooking.locations.id'),
        nullable=False
    )

    # relationship backrefs:
    # - location (Location.holidays)

    @return_ascii
    def __repr__(self):
        return u''.format(self.id, self.date, self.name or 'n/a', self.location.name)