Exemplo n.º 1
0
def all():
    """ view all donation """
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 2
0
def show_alice(donor_name="Alice"):
    donations = Donation().select().join(Donor).where(Donor.name == donor_name)
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 3
0
def all():
    """Gets all donation from database
       and return page with donation"""
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 4
0
def all():
    '''
    All donations page
    '''
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 5
0
def all():
    if 'username' not in session:
        return redirect(url_for('login'))
    return render_template('donations.jinja2', donations=Donation.select())
def show_all():
    """Handle a page showing all donors and donations."""
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 7
0
def all():
    """
    Returns all donors and their donations currently on record
    """
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 8
0
def donations():
    donations = Donation.select()
    return render_template('donations.html', donations=donations)
Exemplo n.º 9
0
import random
from passlib.hash import pbkdf2_sha256
from model import db, Donor, Donation

db.connect()

# This line will allow you "upgrade" an existing database by
# dropping all existing tables from it.
db.drop_tables([Donor, Donation])

db.create_tables([Donor, Donation])

alice = Donor(name="Alice", password=pbkdf2_sha256.hash("alice1"))
alice.save()

bob = Donor(name="Bob", password=pbkdf2_sha256.hash("bob2"))
bob.save()

charlie = Donor(name="Charlie", password=pbkdf2_sha256.hash("charlie3"))
charlie.save()

donors = [alice, bob, charlie]

for x in range(30):
    Donation(donor=random.choice(donors),
             value=round(random.uniform(100, 10000), 2)).save()
Exemplo n.º 10
0
def all():
    """All Donations (http://localhost:6738/donations/)"""
    donations = Donation.select()
    return render_template('donations.html', donations=donations)
Exemplo n.º 11
0
def donations():
    """ list all the donations for all donors """
    _donations = Donation.select()
    return render_template('donations.jinja2', donations=_donations)
Exemplo n.º 12
0
def donor_query(donor):
    donations = Donation.select().join(Donor).where(Donor.name == donor.title())
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 13
0
import random

from model import db, Donor, Donation

db.connect()

# This line will allow you "upgrade" an existing database by
# dropping all existing tables from it.
db.drop_tables([Donor, Donation])

db.create_tables([Donor, Donation])

alice = Donor(name="Alice Stephenson", email="*****@*****.**")
alice.save()

bob = Donor(name="Bob Novak", email='*****@*****.**')
bob.save()

charlie = Donor(name="Charlie Harper", email='*****@*****.**')
charlie.save()

donors = [alice, bob, charlie]

for donor in donors:
    Donation(donor=donor, value=random.randint(100, 10000)).save()
Exemplo n.º 14
0
def all_donations():
    """list all donations in the db"""
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 15
0
def all_name(name):
    donations = [
        donation for donation in Donation.select()
        if donation.donor.name == name.capitalize()
    ]
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 16
0
def list_all():
    donations = Donation.select()
    return render_template("donations.jinja2", donations=donations)
Exemplo n.º 17
0
# This line will allow you "upgrade" an existing database by
# dropping all existing tables from it.
db.drop_tables([Donor, Donation, Admin])
#
db.create_tables([Donor, Donation, Admin])

alice = Donor.create(name="Alice")
# alice.save()

bob = Donor.create(name="Bob")
# bob.save()

charlie = Donor.create(name="Charlie")
# charlie.save()

donors = [alice, bob, charlie]

for x in range(30):
    Donation.create(donor=random.choice(donors),
                    value=random.randint(100, 10000))

user1 = Admin.create(user="******", password=pbkdf2_sha256.hash("password"))
user2 = Admin.create(user="******", password=pbkdf2_sha256.hash("123456"))

# try:
#     user = Admin.get(Admin.user == 'admin')
# except DoesNotExist:
#     user = None
# print(user)
Exemplo n.º 18
0
def spec_user(donor):
    donations = Donation.select().join(Donor).where(donor.name == donor)
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 19
0
def list_donations():
    """get Donation table and post it"""
    return render_template('donations.jinja2', donations=Donation.select())
Exemplo n.º 20
0
def all():
    #    donations = Donation.select()
    if request.method == 'POST':
        return redirect(url_for('create'))
    return render_template('donations.jinja2', donations=Donation.select())
Exemplo n.º 21
0
def all():
    """ Function to display list of all donations """

    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 22
0
def donationsfordonor(dname):
    donations = Donation.select()
    return render_template('individualdon.jinja2', dname=dname, donations=donations)
Exemplo n.º 23
0
def all():
    donations = Donation.select().order_by(Donation.donor.asc(),
                                           Donation.value.desc())
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 24
0
def all():
    '''Displays all donations'''
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 25
0
def single_donor(donor_name):
    donations = Donation().select().join(Donor).where(Donor.name == donor_name)
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 26
0
def all():
    """ Displays all donation records """
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 27
0
def all():
    donations = Donation.select()
    return render_template('donations.jinja2', donations=donations)
Exemplo n.º 28
0
def report():
    donations = Donation.select(Donation.donor, fn.Sum(Donation.value).alias
                                ('total'), fn.Avg(Donation.value).alias
                                ('average')).group_by(Donation.donor)
    return render_template('report.jinja2', donations=donations)
Exemplo n.º 29
0
import random
from model import db, Donor, Donation, User
from passlib.hash import pbkdf2_sha256

db.connect()

# This line will allow you "upgrade" an existing database by
# dropping all existing tables from it.
db.drop_tables([Donor, Donation, User])

db.create_tables([Donor, Donation, User])

alice = Donor(name="Alice")
alice.save()

bob = Donor(name="Bob")
bob.save()

charlie = Donor(name="Charlie")
charlie.save()

donors = [alice, bob, charlie]

for x in range(30):
    Donation(donor=random.choice(donors), value=random.randint(100,
                                                               10000)).save()

User(name='admin', password=pbkdf2_sha256.hash("password")).save()
Exemplo n.º 30
0
def report():
    return render_template('report.jinja2',
                           donor_info=donor_info(),
                           donations=Donation.select())