예제 #1
0
class Users(UserMixin, db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(60))
    password = db.Column(db.String(60))
    arc = db.Boolean()
    zid = db.Column(db.String(8))
    registered = db.Column(db.Integer, db.ForeignKey("registered.id"))
예제 #2
0
class User(db.Model):
    
    
    __tablename__ = "users"
    id = db.Column('user_id', db.Integer, primary_key=True)
    username = db.Column('username', db.String(20), unique=True, index=True)
    password = db.Column('password', db.String(10))
    email = db.Column('email', db.String(50), unique=True, index=True)
    
    def __init__(self, username, password, email):
        self.username = username
        self.password = password
        self.email = password
        self.email = email
        
    def is_authenticated(self):
        return True
        
    def is_active(self):
        return True
    
    def is_anonymous(self):
        return False
        
    def get_id(self):
        return unicode(self.id)
        
    def __repr__(self):
        return '<User %r>' % (self.username)
예제 #3
0
파일: models.py 프로젝트: lars-alfonse/Eddy
class Email(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(100), index=True, unique=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

    def __repr__(self):
        return '<Email %r>' % (self.email)
예제 #4
0
class User(db.Model):

    __tablename__ = 'users'

    # Serial Number
    sno = db.Column(db.Integer, primary_key=True)

    # Organisation
    organisation = db.Column(db.String(128), nullable=False)

    # User Name
    name = db.Column(db.String(128), nullable=False)

    # Github username
    github_username = db.Column(db.String(128), nullable=False)

    # New instance instantiation procedure
    def __init__(self, organisation, name, github_username):

        self.organisation = organisation
        self.name = name
        self.github_username = github_username

    def __repr__(self):
        return json.dumps([self.name, self.github_username])
예제 #5
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)  #id is a built-in!!!
    username = db.Column(db.String(32), index=True, unique=True)
    #email = db.Column(db.String(64), index=True, unique=True) #really needed?
    psw_hash = db.Column(db.String(128))

    def __repr__(self):
        return f'User {self.username}'
예제 #6
0
class Movie(db.Model):
    __tablename__ = 'Movie'

    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(80))
    year = db.Column(db.Integer)
    description = db.Column(db.String())
    actors = db.relationship('Role', back_populates='movie')
예제 #7
0
class Cost(db.Model):
    __tablename__ = 'stu3'

    stunum = db.Column(db.String, primary_key=True)
    time = db.Column(db.String, primary_key=True)
    place = db.Column(db.String, primary_key=True)
    restaurant = db.Column(db.String, primary_key=False)
    cost = db.Column(db.Float, default=0.0, primary_key=False)
예제 #8
0
파일: models.py 프로젝트: lars-alfonse/Eddy
class Song(db.Model):
    def __repr__(self):
        return str(self)

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100))
    seconds = db.Column(db.Integer)
    path = db.Column(db.String(200), unique=True)
    file = db.Column(db.LargeBinary)
예제 #9
0
class Role(db.Model):
    __tablename__ = 'Role'

    id = db.Column(db.Integer, primary_key=True)
    movie_id = db.Column(db.Integer, db.ForeignKey('Movie.id'), nullable=False)
    actor_id = db.Column(db.Integer, db.ForeignKey('Actor.id'), nullable=False)
    role = db.Column(db.String(80), nullable=False)
    actor = db.relationship('Actor', back_populates='movies')
    movie = db.relationship('Movie', back_populates='actors')
예제 #10
0
class Events(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(100))
    location = db.Column(db.String(30))
    #starttime = db.Column(db.Time)
    #date = db.Column(db.Date)
    secret_code = db.String(6)
    registered_users = db.relationship("Registered", backref="event")
    society = db.Column(db.Integer, db.ForeignKey("societies.id"))
예제 #11
0
class Actor(db.Model):
    __tablename__ = 'Actor'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(80), nullable=False)
    birthdate = db.Column(db.String(30))
    movies = db.relationship('Role', back_populates='actor')

    def __str__(self):
        return self.name
예제 #12
0
class Statement(db.Model):

    __tablename__ = 'statements'

    statement_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    tenant_name = db.Column(db.String(75), nullable=False)
    tenant_id = db.Column(db.Integer,
                          db.ForeignKey('tenants.tenant_id'),
                          nullable=False)
    unit_id = db.Column(db.Integer,
                        db.ForeignKey('units.unit_id'),
                        nullable=False)
    transaction_type = db.Column(db.String(75), nullable=False)
    transaction_amount = db.Column(db.Float, nullable=False)
    transaction_date = db.Column(db.Date, nullable=False)
    net_amount = db.Column(db.Float, nullable=False)

    def __init__(self, tenant_id, unit_id, tenant_name, transaction_type,
                 transaction_amount, net_amount, transaction_date, public_id):
        self.public_id = public_id
        self.tenant_id = tenant_id
        self.unit_id = unit_id
        self.tenant_name = tenant_name
        self.transaction_type = transaction_type
        self.transaction_amount = transaction_amount
        self.transaction_date = transaction_date
        self.net_amount = net_amount
예제 #13
0
class Post(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    date_posted = db.Column(db.DateTime,
                            nullable=False,
                            default=datetime.utcnow)
    content = db.Column(db.Text, nullable=False)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)

    def __repr__(self):
        return f"Post('{self.title}', '{self.date_posted}')"
예제 #14
0
class PaymentType(db.Model):
    __tablename__ = 'payment_types'

    type_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    type_code = db.Column(db.String(12), nullable=False, unique=True)
    type_meaning = db.Column(db.String(75), nullable=False, unique=True)

    def __init__(self, public_id, type_code, type_meaning):
        self.public_id = public_id
        self.type_code = type_code
        self.type_meaning = type_meaning
예제 #15
0
class User(db.Model, UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(20), unique=True, nullable=False)
    email = db.Column(db.String(120), unique=True, nullable=False)
    image_file = db.Column(db.String(20),
                           nullable=False,
                           default='default.jpg')
    password = db.Column(db.String(60), nullable=False)
    posts = db.relationship('Post', backref='author', lazy=True)

    def __repr__(self):
        return f"User('{self.username}', '{self.email}', '{self.image_file}')"
예제 #16
0
class Record(db.Model):

    __tablename__ = 'records'
    id = db.Column(db.Integer, primary_key=True)
    artist_name = db.Column(db.String(20), index=True)
    record_name = db.Column(db.String(20), index=True)

    def __init__(self, artist_name, record_name):
        self.artist_name = artist_name
        self.record_name = record_name

	
예제 #17
0
class Todo(db.Model):
    __tablename__ == "todos"
    id = db.Column('todo_id', db.Integer, primary_key=True)
    title = db.Column(db.String(60))
    text = db.Column(db.String)
    done = db.Column(db.Boolean)
    pub_date = db.Column(db.DateTime)

    def __init__(self, title, text):
        self.title = title
        self.text = text
        self.done = False
        self.pub_date = datetime.utcnow().time()
예제 #18
0
class RevokedTokenModel(db.Model):
    __tablename__ = 'revoked_tokens'
    id = db.Column(db.Integer, primary_key = True)
    jti = db.Column(db.String(120))
    
    def add(self):
        db.session.add(self)
        db.session.commit()
    
    @classmethod
    def is_jti_blacklisted(cls, jti):
        query = cls.query.filter_by(jti = jti).first()
        return bool(query)
예제 #19
0
class Status(db.Model):

    __tablename__ = 'status'

    status_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    status_code = db.Column(db.Integer, nullable=False, unique=True)
    status_meaning = db.Column(db.String(75), nullable=False, unique=True)

    def __init__(self, status_code, status_meaning, public_id):
        self.public_id = public_id
        self.status_code = status_code
        self.status_meaning = status_meaning
예제 #20
0
class Daily(db.Model):
    __tablename__ = 'daily'

    id = db.Column(db.Integer, primary_key=True)
    date = db.Column(db.DateTime())
    total_cases = db.Column(db.Integer())
    total_deaths = db.Column(db.Integer())
    total_recoveries = db.Column(db.Integer())
    daily_cases = db.Column(db.Integer())
    daily_deaths = db.Column(db.Integer())
    daily_recoveries = db.Column(db.Integer())

    def __init__(self, currentDay):
        self.total_cases = int(currentDay.totalCases.replace(',', ''))
        self.total_recoveries = int(currentDay.totalRecoveries.replace(
            ',', ''))
        self.total_deaths = int(currentDay.totalDeaths.replace(',', ''))
        self.date = currentDay.date

    def __repr__(self):
        return '<id {}>'.format(self.id)

    def calculate(self, cases, deaths, recoveries):
        self.daily_cases = self.total_cases - cases
        self.daily_deaths = self.total_deaths - deaths
        self.daily_recoveries = self.total_recoveries - recoveries
예제 #21
0
class Rental(db.Model):

    __tablename__ = 'rentals'

    rental_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    tenant_name = db.Column(db.String(75), nullable=False)
    unit_number = db.Column(db.String(25), nullable=False)
    lease_end_date = db.Column(db.Date, nullable=False)

    def __init__(self, tenant_name, unit_number, lease_end_date, public_id):
        self.public_id = public_id
        self.tenant_name = tenant_name
        self.unit_number = unit_number
        self.lease_end_date = lease_end_date
예제 #22
0
class Payments(db.Model):

    __tablename__ = 'payments'

    payment_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    unit_id = db.Column(db.Integer, db.ForeignKey('units.unit_id'), nullable=False)
    amount_paid = db.Column(db.Float(12), nullable=False)
    date_paid = db.Column(db.Date, nullable=False)

    def __init__(self, unit_id, amount_paid, date_paid,public_id):
        self.public_id = public_id
        self.unit_id = unit_id
        self.amount_paid = amount_paid
        self.date_paid = date_paid
예제 #23
0
class Image(db.Model):

    __tablename__ = 'complaints_images'

    image_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    image_name = db.Column(db.String(75), nullable=False)
    complaint_id = db.Column(db.Integer,
                             db.ForeignKey('complaints.complaint_id'),
                             nullable=False)

    def __init__(self, image_name, complaint_id, public_id):
        self.public_id = public_id
        self.image_name = image_name
        self.complaint_id = complaint_id
예제 #24
0
파일: models.py 프로젝트: lars-alfonse/Eddy
class TrackChange(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    currentTrack = db.Column(db.String(100))
    endTime = db.Column(db.Float)
    pattern = db.Column(db.String(10))
    nextTrack = db.Column(db.String(100))
    startTime = db.Column(db.Float)
    timeOfChange = db.Column(db.DateTime)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
예제 #25
0
class Organisation(db.Model):

    __tablename__ = 'organisations'

    # Serial Number
    sno = db.Column(db.Integer, primary_key=True)

    # Organisation
    organisation = db.Column(db.String(128), nullable=False)

    # New instance instantiation procedure
    def __init__(self, organisation):

        self.organisation = organisation

    def __repr__(self):
        return json.dumps([self.organisation])
예제 #26
0
class ServiceProviders(db.Model):

    __tablename__ = 'service_providers'

    provider_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    provider_name = db.Column(db.String(75), nullable=False)
    provider_contact = db.Column(db.String(15), nullable=False, unique=True)

    #Relationships
    services = db.relationship('Services',
                               backref='service_providers',
                               lazy=True)

    def __init__(self, provider_name, provider_contact, public_id):
        self.public_id = public_id
        self.provider_name = provider_name
        self.provider_contact = provider_contact
예제 #27
0
파일: models.py 프로젝트: Reih02/FH4_Cars
class Car(db.Model):
    __tablename__ = 'Car'

    id = db.Column(db.Integer, primary_key=True, nullable=False, unique=True)
    name = db.Column(db.Text(50), nullable=False)
    horsepower = db.Column(db.Text, nullable=False)
    cost = db.Column(db.Text, nullable=False)
    wheeldrive = db.Column(db.Text, nullable=False)
    weight = db.Column(db.Text, nullable=False)
    image = db.Column(db.Text)
    manufacturerid = db.Column(db.Text, db.ForeignKey('Manufacturer.id'))
예제 #28
0
class Block(db.Model):
    __tablename__ = 'blocks'

    block_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    property_id = db.Column(db.Integer,
                            db.ForeignKey('property.property_id'),
                            nullable=False)
    block_name = db.Column(db.String(35), nullable=False)
    number_of_units = db.Column(db.Integer, nullable=False)

    # Relationships
    units = db.relationship('Unit', backref='blocks', lazy=True)

    def __init__(self, property_id, block_name, number_of_units, public_id):
        self.number_of_units = number_of_units
        self.public_id = public_id
        self.property_id = property_id
        self.block_name = block_name
예제 #29
0
class User(db.Model):
	__tablename__ = 'users'
	uid = db.Column(db.Integer, primary_key = True)
	firstname = db.Column(db.String(100))
	lastname = db.Column(db.String(100))
	email = db.Column(db.String(100), unique = True)
	pwdhash = db.Column(db.String(256))

	def __init__(self, firstname, lastname, email, password):
		self.firstname = firstname.title()
		self.lastname = lastname.title()
		self.email = email.lower()
		self.set_password(password)

	def set_password(self, password):
		self.pwdhash = generate_password_hash(password)

	def check_password(self, password):
		return check_password_hash(self.pwdhash, password)
예제 #30
0
class User(db.Model):
    def randomPasswords(stringLength=8):
        """Generate a random string of letters and digits """
        lettersAndDigits = string.ascii_letters + string.digits
        return ''.join(
            random.choice(lettersAndDigits) for i in range(stringLength))

    def hash_password(self, password):
        self.password_hash = pwd_context.encrypt(password)

    def verify_password(self, password):
        return pwd_context.verify(password, self.password_hash)

    __tablename__ = 'users'

    user_id = db.Column(db.Integer, primary_key=True)
    public_id = db.Column(db.String(70), nullable=False, unique=True)
    email = db.Column(db.String(100), unique=True, nullable=False, index=True)
    password_hash = db.Column(db.String(128), nullable=False)
    category = db.Column(db.String(30), nullable=False)
    account_status = db.Column(db.String(75), nullable=False)

    # blocks = db.relationship('Block', backref='users', lazy=True)
    # rental = db.relationship('Rental', backref='users', lazy=True)
    # complaints = db.relationship('Complaint', backref='users', lazy=True)

    def __init__(self, email, category, account_status, public_id):
        self.public_id = public_id
        self.category = category
        self.email = email
        self.account_status = account_status