Esempio n. 1
0
 def platforms(cls):
     platform_association = db.Table(
         '%s_platform' % cls.__tablename__,
         cls.metadata,
         db.Column('platform_id', db.Integer, db.ForeignKey('platform.id')),
         db.Column('%s_id' % cls.__tablename__, db.Integer,
                   db.ForeignKey('%s.id' % cls.__tablename__)),
     )
     return db.relationship(Platform, secondary=platform_association)
Esempio n. 2
0
 def prices(cls):
     price_association = db.Table(
         '%s_price' % cls.__tablename__,
         cls.metadata,
         db.Column('price_id', db.Integer, db.ForeignKey('price.id')),
         db.Column('%s_id' % cls.__tablename__, db.Integer,
                   db.ForeignKey('%s.id' % cls.__tablename__)),
     )
     return db.relationship(Price, secondary=price_association)
Esempio n. 3
0
 def authorizations(cls):
     authorization_association = db.Table(
         '%s_authorization' % cls.__tablename__,
         cls.metadata,
         db.Column('authorization_id', db.Integer,
                   db.ForeignKey('authorization.id')),
         db.Column('%s_id' % cls.__tablename__, db.Integer,
                   db.ForeignKey('%s.id' % cls.__tablename__)),
     )
     return db.relationship(Authorization,
                            secondary=authorization_association)
Esempio n. 4
0
 def resources(cls):
     resource_association = db.Table(
         '%s_resources' % cls.__tablename__,
         cls.metadata,
         db.Column('resource_id', db.Integer, db.ForeignKey('resource.id')),
         db.Column('%s_id' % cls.__tablename__, db.Integer,
                   db.ForeignKey('%s.id' % cls.__tablename__)),
     )
     return db.relationship(Resource,
                            secondary=resource_association,
                            backref="%s_parents" % cls.__name__.lower())
Esempio n. 5
0
# coding=utf-8

import datetime

from main import db

user_tag = db.Table(
    'user_tag',
    db.Model.metadata,
    db.Column('user_id', db.Integer, db.ForeignKey('users.user_id')),
    db.Column('tag_id', db.Integer, db.ForeignKey('tags.tag_id')),
)


class User(db.Model):
    __tablename__ = 'users'

    user_id = db.Column(
        db.Integer,
        primary_key=True,
    )
    username = db.Column(
        db.String(100),
        nullable=False,
        unique=True,
    )
    password = db.Column(
        db.String(128),
        nullable=False,
    )
    avatar = db.Column(db.String(200), )
#Association_Tables
from main import db
districtHasCron = db.Table(
    'districtHasCron',
    db.Column('district_id', db.Integer, db.ForeignKey('districts.id')),
    db.Column('cron_id', db.Integer, db.ForeignKey('cron.id')))
displayGroupOverwrites = db.Table(
    'displayGroupOverwrites',
    db.Column('displayGroup_id', db.Integer, db.ForeignKey('displayGroup.id')),
    db.Column('overwrite_id', db.Integer, db.ForeignKey('displayGroup.id')))
displayGroupHasDefault = db.Table(
    'displayGroupHasDefault',
    db.Column('displayGroup_id', db.Integer, db.ForeignKey('displayGroup.id')),
    db.Column('default_id', db.Integer, db.ForeignKey('displayGroup.id')))
#Verknüpft eine Gruppe, welche eine Bündelung von Maßnahmen darstellt mit der Gruppe, welche die Maßnahme an sich darstellt.
displayGroupReplicates = db.Table(
    'displayGroupReplicates',
    db.Column('displayGroup_id', db.Integer, db.ForeignKey('displayGroup.id')),
    db.Column('replicats_of_id', db.Integer, db.ForeignKey('displayGroup.id')))
#Verknüpft eine (Default-)Gruppe mit den Gruppen, auß deren Modifizierung diese entstanden ist.
Esempio n. 7
0
from main import db

from main.models import Course, Student

university_course = db.Table(
    'university_course',
    db.Column('university_id',
              db.Integer,
              db.ForeignKey('university.id'),
              primary_key=True),
    db.Column('course_id',
              db.Integer,
              db.ForeignKey('course.id'),
              primary_key=True))

university_professor = db.Table(
    'university_professor',
    db.Column('university_id',
              db.Integer,
              db.ForeignKey('university.id'),
              primary_key=True),
    db.Column('professor_id',
              db.String(11),
              db.ForeignKey('professor.id'),
              primary_key=True))


class UniversityModel(db.Model):

    __tablename__ = 'university'
Esempio n. 8
0
from main import db

Project_Genre = db.Table(
    'Project_Genre', db.Model.metadata,
    db.Column('Project_id', db.Integer, db.ForeignKey('Project.id')),
    db.Column('Genre_id', db.Integer, db.ForeignKey('Genre.id')))


class Project(db.Model):
    __tablename__ = 'Project'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())
    image = db.Column(db.String())
    description = db.Column(db.Text())
    category = db.Column(db.Integer)

    genre = db.relationship('Genre',
                            secondary=Project_Genre,
                            back_populates='project')


class Category(db.Model):
    __tablename__ = 'Category'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())


class Genre(db.Model):
    __tablename__ = 'Genre'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String())
Esempio n. 9
0
                return (obj.y, obj.x)
        return None

    @classmethod
    def get_enabled_events(self):
        sources = CalendarSource.query.filter_by(published=True, displayed=True)
        events = []
        for source in sources:
            events.extend(source.events)
        return events


FavouriteCalendarEvent = db.Table(
    "favourite_calendar_event",
    BaseModel.metadata,
    db.Column("user_id", db.Integer, db.ForeignKey("user.id"), primary_key=True),
    db.Column(
        "event_id", db.Integer, db.ForeignKey("calendar_event.id"), primary_key=True
    ),
)


class CalendarEvent(BaseModel):
    __tablename__ = "calendar_event"

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.String)
    start_dt = db.Column(db.DateTime(), nullable=False)
    end_dt = db.Column(db.DateTime(), nullable=False)
    displayed = db.Column(db.Boolean, nullable=False, default=True)

    source_id = db.Column(
Esempio n. 10
0
    def remove_role(self, name):
        """Remove a role (by name) from the user."""
        role = Role.by_name(name)
        if not role:
            return
        if role in self.roles:
            self.roles.remove(role)

    def __repr__(self):
        return '<%s %s (%s)>' % (self.__class__.__name__,
            self.fullname.encode('utf8') or '?', self.login.encode('utf8'))


UsersRolesTable = db.Table('users_roles', db.metadata,
    db.Column('user_id', db.Integer, db.ForeignKey(User.id)),
    db.Column('role_id', db.Integer, db.ForeignKey(Role.id))
)


def create_admin():
    """Create the admin user (if it doesn't already exist)"""
    from pyceo import prompt
    from .manage import create_user

    u = User.by_login(u'admin')
    if not u:
        print 'Creating the `admin` user…'
        email = prompt('>>> `admin` email?\n')
        create_user(u'admin', 'admin', fullname=u'Admin', email=email)
        u = User.by_login(u'admin')
Esempio n. 11
0
from main import db, app

cdm = app.config["SCHEMA_CDM"]

t_concept = db.Table("concept",
                     db.Column("concept_id",
                               db.Integer,
                               primary_key=True,
                               unique=True),
                     db.Column("concept_name", db.String(255), nullable=False),
                     db.Column("domain_id", nullable=False, index=True),
                     db.Column("vocabulary_id", nullable=False, index=True),
                     db.Column("concept_class_id", nullable=False, index=True),
                     db.Column("standard_concept", db.String(1)),
                     db.Column("concept_code",
                               db.String(50),
                               nullable=False,
                               index=True),
                     db.Column("valid_start_date", db.Date, nullable=False),
                     db.Column("valid_end_date", db.Date, nullable=False),
                     db.Column("invalid_reason", db.String(1)),
                     schema=cdm,
                     extend_existing=True)

t_person = db.Table("person",
                    db.Column("person_id", db.Integer, primary_key=True),
                    db.Column("gender_concept_id", db.Integer, nullable=False),
                    db.Column("year_of_birth", db.Integer, nullable=False),
                    db.Column("month_of_birth", db.Integer, nullable=True),
                    db.Column("day_of_birth", db.Integer, nullable=True),
                    db.Column("race_concept_id", db.Integer, nullable=False),
Esempio n. 12
0
from main import db, bcrypt

from main.models import SchoolRecord, Quiz, Subject, Course, University, Classroom


student_subject = db.Table(
    'student_subject',
    db.Column('student_id', db.String(8), db.ForeignKey(
        'student.id'), primary_key=True),

    db.Column('subject_id', db.Integer, db.ForeignKey(
        'subject.id'), primary_key=True)
)

student_quiz = db.Table(
    'student_quiz',
    db.Column('student_id', db.String(8), db.ForeignKey(
        'student.id'), primary_key=True),
    db.Column('quiz_id', db.Integer, db.ForeignKey(
        'quiz.id'), primary_key=True),
)


class StudentModel(db.Model):

    __tablename__ = 'student'

    id = db.Column(db.String(8), primary_key=True)  # Número da matrícula
    first_name = db.Column(db.String(100), nullable=False)
    last_name = db.Column(db.String(100), nullable=False)
    password = db.Column(db.String(60), nullable=False)
Esempio n. 13
0
# -*- coding: utf-8 -*-

from main import db
from sqlalchemy.orm import relationship

tags_links = db.Table(
    'tags_links', db.metadata,
    db.Column('id_tags', db.Integer, db.ForeignKey('tags.id')),
    db.Column('id_torrent', db.Integer, db.ForeignKey('torrents.id')))


class Tags(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), unique=True)

    def __init__(self, name):
        self.name = name


class Accounts(db.Model):
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(255), unique=True)
    password = db.Column(db.String(255))
    status = db.Column(db.Integer)

    def __init__(self, name, password, status):
        self.name = name
        self.password = password
        self.status = status

Esempio n. 14
0
from main import db

doctor_address = db.Table('doctor_address',
    db.Column('doctor_id', db.Integer, db.ForeignKey('doctor.id')),
    db.Column('address_id', db.Integer, db.ForeignKey('address.id'))
)

class Doctor(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String)
    occupation = db.Column(db.String)
    addresses = db.relationship('Address', secondary=doctor_address,
                                lazy='subquery', backref=db.backref('doctors', lazy='joined'))
    ratings = db.relationship('Rating', backref='doctor', lazy=True)

    def serialize(self, deep=False):
        doctor = {"id": self.id,
                  "name": self.name,
                  "occupation": self.occupation,
                  "ratings": []}

        for rating in self.ratings:
            doctor['ratings'].append(rating.serialize())

        if deep:
            doctor['addresses'] = []
            for address in self.addresses:
                doctor['addresses'].append(address.serialize())

        return doctor
Esempio n. 15
0
from sqlalchemy import BigInteger, Column, Integer, String, Table
from main import app, db


t_test_log = db.Table(
    'test',
    db.Column('id', db.BigInteger, primary_key=True),
    db.Column('name', db.String),
    db.Column('count', db.BigInteger),

    schema=app.config['SCHEMA_TEST'],
    extend_existing=True
)


def get_test_id_in_table(test_id):
  count_row = db.session.query(t_test_log).filter(t_test_log.c.id == test_id).first()
  return count_row._asdict()


def insert_test_id_in_table(test_id, test_name, test_count):
  db.session.execute(
      t_test_log.insert().values({
          t_test_log.c.id: test_id,
          t_test_log.c.name: test_name,
          t_test_log.c.count: test_count
      })
  )
  db.session.commit()

Esempio n. 16
0
# -*- coding: utf-8 -*-
"""
    main.users.models
    ~~~~~~~~~~~~~~~~~

    유저 정보 DB 모델
"""

from main import db
from datetime import datetime, timezone

user_role = db.Table(
    'user_role',
    db.Column('user_id',
              db.Integer,
              db.ForeignKey('user.id', ondelete='cascade'),
              nullable=False),
    db.Column('role_id',
              db.Integer,
              db.ForeignKey('role.id', ondelete='cascade'),
              nullable=False))


class Role(db.Model):

    __tablename__ = 'role'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), unique=True, nullable=False)
    description = db.Column(db.String(255), nullable=True)

from main import db

track_playlist_association_table = db.Table(
    "track_playlist_association_table", db.Model.metadata,
    db.Column("playlist_id",
              db.Integer,
              db.ForeignKey("playlists.id"),
              primary_key=True),
    db.Column("track_id",
              db.Integer,
              db.ForeignKey("tracks.id"),
              primary_key=True))
Esempio n. 18
0
from sqlalchemy import Column, Table
from sqlalchemy.types import Integer, String, Boolean
from main import db
import requests
from hashlib import md5
from datetime import datetime
from flask_login import UserMixin
from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired, Length, ValidationError
from flask_wtf import FlaskForm
"""
Users Following database
"""
followers = db.Table(
    'followers', db.Column('follower_id', db.Integer,
                           db.ForeignKey('user.id')),
    db.Column('followed_id', db.Integer, db.ForeignKey('user.id')))


# UserMixin
class User(UserMixin, db.Model):
    """
    User model for reviewers.
    """
    __tablename__ = 'user'
    id = Column(Integer, autoincrement=True, primary_key=True)
    active = Column(Boolean, default=True)
    username = Column(String(200), unique=True)
    email = Column(String(200), unique=True)
    password = Column(String(200), default='')
    admin = Column(Boolean, default=False)
Esempio n. 19
0
from main import db


group_content = db.Table(
    'group_content',
    db.Column(
        'group_id', db.Integer, db.ForeignKey(
            'groups.group_id', ondelete='CASCADE'), primary_key=True),
    db.Column(
        'content_id', db.Integer, db.ForeignKey(
            'content.content_id', ondelete='CASCADE'), primary_key=True))

unrecommend = db.Table(
    'unrecommend',
    db.Column(
        'profile_id', db.Integer, db.ForeignKey(
            'profiles.profile_id', ondelete='CASCADE'), primary_key=True),
    db.Column(
        'content_id', db.Integer, db.ForeignKey(
            'content.content_id', ondelete='CASCADE'), primary_key=True))
Esempio n. 20
0
from sqlalchemy import Column, Integer, ForeignKey
from main import db

FlatsLandlords = db.Table('flats_landlords', db.Model.metadata,
                       Column('flat_id', Integer, ForeignKey('flat.id'), primary_key=True),
                       Column('landlord_id', Integer, ForeignKey('landlord.id'), primary_key=True))
Esempio n. 21
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    contactName = db.Column(db.String(20), nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
    imageFile = db.Column(db.String(20), nullable=False, default='default.jpg')
    password = db.Column(db.String(60), nullable=False)
    phoneNumber = db.Column(db.String(12), nullable=False, unique=True)
    ads = db.relationship('Ad', backref='author', lazy=True, cascade="delete")

    def __repr__(self):
        return f"User('{self.contactName}', '{self.email}', '{self.phoneNumber}')"


payingTypes = db.Table('adPayingTypes',
    db.Column('adId', db.Integer, db.ForeignKey('ad.id'), primary_key=True),
    db.Column('payingTypeId', db.Integer, db.ForeignKey('paying_types.id'), primary_key=True)
)


class Ad(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    datePosted = db.Column(db.DateTime, nullable=False, default=datetime.utcnow)
    description = db.Column(db.Text, nullable=False)
    userId = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    images = db.relationship('Image', backref='author', lazy=True, cascade="delete")
    payingTypes = db.relationship('PayingType', secondary=payingTypes, lazy='subquery',
                           backref=db.backref('ads', lazy=True), cascade="delete")
    books = db.relationship('Book', backref='ad', lazy=True, cascade="delete")
Esempio n. 22
0
from main import db

users_attending_events = db.Table(
    'users_attending_events', db.Model.metadata,
    db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
    db.Column('event_id', db.Integer, db.ForeignKey('event.id')))


class User(db.Model):
    __tablename__ = 'user'
    id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(50), unique=True)
    name = db.Column(db.String(50))
    email = db.Column(db.String(50), unique=True)
    password = db.Column(db.String(100))
    attending_events = db.relationship('Event',
                                       secondary=users_attending_events,
                                       lazy="dynamic",
                                       backref="attendees")


class Event(db.Model):
    __tablename__ = 'event'
    id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(50), unique=True)
    user_id = db.Column(db.String(50))
    name = db.Column(db.String(50))
    description = db.Column(db.String(500))
    start = db.Column(db.String(50))
    end = db.Column(db.String(50))
    type = db.Column(db.String(50))
from flask import Blueprint, render_template, redirect, url_for, request, flash
from werkzeug import secure_filename
import uuid
from main import db
import json
from flask_login import UserMixin
from datetime import datetime, timedelta
import jwt
from werkzeug.security import generate_password_hash, check_password_hash

organizations = db.Table(
    'organizations',
    db.Column('organization_id',
              db.Integer,
              db.ForeignKey('organization.id'),
              primary_key=True),
    db.Column('user_id',
              db.Integer,
              db.ForeignKey('user.id'),
              primary_key=True),
)


class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    branchOfGov = db.Column(db.String(255))
    organizations = db.relationship('Organization',
                                    secondary=organizations,
                                    lazy='subquery',
                                    backref=db.backref('users', lazy=True))
Esempio n. 24
0
from datetime import datetime
from time import time

import jwt
from flask_login import UserMixin
from werkzeug.security import generate_password_hash, check_password_hash

from main import db, login, app

# Helper tables for ManyToMany relationships, no class needed
areas_volunteers = db.Table('areas_vs_volunteers',
                            db.Column('area', db.String(80), db.ForeignKey('area.area'), primary_key=True),
                            db.Column('vol_id', db.Integer, db.ForeignKey('volunteer.id'), primary_key=True))


volunteers_species = db.Table('volunteers_vs_species',
                              db.Column('vol_id', db.Integer, db.ForeignKey('volunteer.id'), primary_key=True),
                              db.Column('foster_species', db.String(20), db.ForeignKey('foster_species.species'), primary_key=True))


class Clinic(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(120), index=True, unique=True, nullable=False)
    name = db.Column(db.String(250), index=True, unique=True, nullable=False)
    password_hash = db.Column(db.String(128))
    phone_numbers = db.relationship('PhoneNumber', backref='clinic', lazy='subquery')
    area_name = db.Column(db.String(80), db.ForeignKey('area.area'), nullable=True)
    active = db.Column(db.Boolean, default=True)
    admin = db.Column(db.Boolean, default=False)

    def __repr__(self):
Esempio n. 25
0
from main import db
from models.Track import Track

playlist_tracks = db.Table(
    "playlist_tracks",
    db.Column('playlist_id', db.Integer,
              db.ForeignKey('playlists.playlist_id')),
    db.Column('track_id', db.Integer, db.ForeignKey('tracks.track_id')))


class Playlist(db.Model):
    __tablename__ = "playlists"

    playlist_id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(), nullable=False)
    owner_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
    description = db.Column(db.String())
    collaborative = db.Column(db.Boolean(), nullable=False)
    public = db.Column(db.Boolean(), nullable=False)
    playlist_tracks = db.relationship('Track',
                                      secondary=playlist_tracks,
                                      backref=db.backref('playlist_tracks',
                                                         lazy='dynamic'))
Esempio n. 26
0
    invoices = db.relationship('Invoices', backref='customer', lazy=True)

class Basket(db.Model):
    __tablename__ = 'basket'
    id = db.Column(db.Integer, primary_key=True)
    product_id = db.Column(db.Integer, unique=True, nullable=False)
    product_name = db.Column(db.String(80), nullable=False)
    product_price = db.Column(db.Integer, default=0)
    product_group = db.Column(db.String(30), nullable=False)
    product_quantity = db.Column(db.Integer, default=0)
    stock_quantity = db.Column(db.Integer, default=0)
    product_amount = db.Column(db.Integer, default=0)


orders = db.Table('orders',
                  db.Column('products_id', db.Integer, db.ForeignKey('products.products_id')),
                  db.Column('invoices_id', db.Integer, db.ForeignKey('invoices.invoices_id'))
                  )

class Products(db.Model):
    __tablename__ = 'products'
    products_id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    group = db.Column(db.String(30), nullable=False)
    stock_quantity = db.Column(db.Integer, default=0)
    price = db.Column(db.Integer, default=0)
    ordering = db.relationship('Invoices', secondary=orders, backref=db.backref('invoicing'), lazy='dynamic')
    product_qty = db.relationship('Quantities', backref='product', lazy=True)

    # def __repr__(self):
    #     return "Products(products_id={}, name='{}', group='{}', quantity='{}', price='{}'".format(self.products_id, self.name, self.group, self.quantity, self.price)
Esempio n. 27
0
        events = CalendarEvent.query.filter_by(source_id=self.id)
        to_delete = [p for p in events if p.uid not in uid_seen]

        for e in to_delete:
            db.session.delete(e)

    @classmethod
    def get_enabled_events(self):
        sources = CalendarSource.query.filter_by(enabled=True)
        events = []
        for source in sources:
            events.extend(source.events)
        return events

FavouriteCalendarEvent = db.Table('favourite_calendar_event', db.Model.metadata,
    db.Column('user_id', db.Integer, db.ForeignKey('user.id'), primary_key=True),
    db.Column('event_id', db.Integer, db.ForeignKey('calendar_event.id'), primary_key=True),
)

class CalendarEvent(db.Model):
    __tablename__ = 'calendar_event'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.String)
    start_dt = db.Column(db.DateTime(), nullable=False)
    end_dt = db.Column(db.DateTime(), nullable=False)

    source_id = db.Column(db.Integer, db.ForeignKey(CalendarSource.id),
                                      nullable=False, index=True)
    summary = db.Column(db.String, nullable=True)
    description = db.Column(db.String, nullable=True)
    location = db.Column(db.String, nullable=True)
Esempio n. 28
0

class CfpStateException(Exception):
    pass


class InvalidVenueException(Exception):
    pass


FavouriteProposal = db.Table(
    'favourite_proposal',
    db.Model.metadata,
    db.Column('user_id',
              db.Integer,
              db.ForeignKey('user.id'),
              primary_key=True),
    db.Column('proposal_id',
              db.Integer,
              db.ForeignKey('proposal.id'),
              primary_key=True),
)


class Proposal(db.Model):
    __versioned__ = {'exclude': ['favourites', 'favourite_count']}
    __tablename__ = 'proposal'

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    anonymiser_id = db.Column(db.Integer,
                              db.ForeignKey('user.id'),
Esempio n. 29
0
# coding=utf-8
from sqlalchemy.orm import backref
from flask_login import UserMixin

from main import db


# This effectively records the roles that a volunteer is interested in
VolunteerRoleInterest = db.Table(
    "volunteer_role_interest",
    db.Model.metadata,
    db.Column(
        "volunteer_id", db.Integer, db.ForeignKey("volunteer.id"), primary_key=True
    ),
    db.Column(
        "role_id", db.Integer, db.ForeignKey("volunteer_role.id"), primary_key=True
    ),
)


# Which roles has the volunteer been trained for
VolunteerRoleTraining = db.Table(
    "volunteer_role_training",
    db.Model.metadata,
    db.Column(
        "volunteer_id", db.Integer, db.ForeignKey("volunteer.id"), primary_key=True
    ),
    db.Column(
        "role_id", db.Integer, db.ForeignKey("volunteer_role.id"), primary_key=True
    ),
)
Esempio n. 30
0
    'performance': ['Stage A'],
    'installation': []
}


class CfpStateException(Exception):
    pass


class InvalidVenueException(Exception):
    pass


FavouriteProposals = db.Table(
    'favourite_proposals',
    db.Column('user_id', db.Integer, db.ForeignKey('user.id')),
    db.Column('proposal_id', db.Integer, db.ForeignKey('proposal.id')),
)


class Proposal(db.Model):
    __versioned__ = {}
    __tablename__ = 'proposal'

    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
    anonymiser_id = db.Column(db.Integer,
                              db.ForeignKey('user.id'),
                              default=None)
    created = db.Column(db.DateTime, default=datetime.utcnow, nullable=False)
    modified = db.Column(db.DateTime,