コード例 #1
0
ファイル: players.py プロジェクト: GSargsyan/Aquila
    def initial_values(self):
        """ Get the initial Player values for registration

        Returns
        -------
        dict
            Initial values
        """
        return {
            'username': None,
            'password': None,
            'balance': 0,
            'token': None,
            'demo_balance': game_conf['initial_demo_bal'],
            'level_id': None,
            'exp': 0,
            'wagered': 0,
            'won': 0,
            'lost': 0,
            'status': 'alive',
            'chat_messages_count': 0,
            'bets_count': 0,
            'bets_won_count': 0,
            'country_id': Countries.iso2_from_ip(request.remote_addr),
            'registered_date': now(),
            'settings': None,
            'room_id': None,
            'last_checkup': None,
            'is_online': True
        }
コード例 #2
0
ファイル: create.py プロジェクト: Faro145/flask-exercises
from app import db, Countries, Cities

db.create_all()

UK = Countries(name = 'United Kingdom')
db.session.add(UK)
db.session.commit()

ldn = Cities(name='London', country = UK)
mcr = Cities(name='Manchester', country = Countries.query.filter_by(name='United Kingdom').first())

db.session.add(ldn)
db.session.add(mcr)
db.session.commit()
コード例 #3
0
ファイル: create.py プロジェクト: armankhanx14/flask-apps
from app import db, Countries, Cities

db.create_all()  # Creates all table classes defined

UK = Countries(name='United Kingdom')  #Add example to countries table
db.session.add(UK)
db.session.commit()

# Here we reference the country that london belongs to useing 'country', this is what we named the backref variable in db.relationship()
ldn = Cities(name='London', country=UK)
mcr = Cities(name='Manchester',
             country=Country.query.filter_by(name='United Kingdom').first())

db.session.add(ldn)
db.session.add(mcr)
db.session.commit()
コード例 #4
0
from app import db, Countries, Cities

db.create_all()

ITALY = Countries(name='Italy')
db.session.add(ITALY)
db.session.commit()

Rome = Cities(name='Rome', country=ITALY)
#mcr = Cities(name='Manchester', country = Countries.query.filter_by(name='United Kingdom').first())

db.session.add(Rome)
#db.session.add(mcr)
db.session.commit()