Exemplo n.º 1
0
def uwp_team():
    dsn = app.config['dsn']
    page = UWP(dsn)
    if request.method == 'GET':
        return page.show_page_team()
    elif 'Add' in request.form:
        country = request.form['Country']
        if country:
            return page.add_team(country)
        else:
            flash("You need to enter a country name!")
            return page.show_page_team()
    elif 'Delete' in request.form:
        id = request.form.get('select', '')
        if id:
            return page.delete_team(id)
        else:
            flash(
                "You need to select the team you want to delete using the radio buttons!"
            )
            return page.show_page_team()
    elif 'Update' in request.form:
        id = request.form.get('select', '')
        country = request.form['Country']
        if country and id:
            return page.update_team(country, id)
        else:
            if not id:
                flash(
                    "You need to select the team you want to update using the radio buttons!"
                )
            if not country:
                flash("You need to enter a country name!")
            return page.show_page_team()
Exemplo n.º 2
0
def uwp_team():
    dsn = app.config['dsn']
    page = UWP(dsn)
    if request.method == 'GET':
        return page.show_page_team()
    elif 'Add' in request.form:
        country = request.form['Country']
        if country:
            return page.add_team(country)
        else:
            flash("You need to enter a country name!")
            return page.show_page_team()
    elif 'Delete' in request.form:
        id = request.form.get('select', '')
        if id:
            return page.delete_team(id)
        else:
            flash("You need to select the team you want to delete using the radio buttons!")
            return page.show_page_team()
    elif 'Update' in request.form:
        id = request.form.get('select', '')
        country = request.form['Country']
        if country and id:
            return page.update_team(country, id)
        else:
            if not id:
                flash("You need to select the team you want to update using the radio buttons!")
            if not country:
                flash("You need to enter a country name!")
            return page.show_page_team()
Exemplo n.º 3
0
def uwp_comp():
    dsn = app.config['dsn']
    page = UWP(dsn)
    if request.method == 'GET':
        return page.show_page_comp()
    elif 'Add' in request.form:
        name = request.form['Name']
        surname = request.form['Surname']
        country = request.form['Country']
        role = request.form['Role']
        if name and surname:
            return page.add_competitor(name, surname, country, role)
        else:
            flash("You need to enter a name and a surname!")
            return page.show_page_comp()
    elif 'Delete' in request.form:
        id = request.form.get('select', '')
        if id:
            return page.delete_competitor(id)
        else:
            flash(
                "You need to select the competitor you want to delete using the radio buttons!"
            )
            return page.show_page_comp()

    elif 'Update' in request.form:
        id = request.form.get('select', '')
        name = request.form['Name']
        surname = request.form['Surname']
        country = request.form['Country']
        role = request.form['Role']
        if id and name and surname:
            return page.update_competitor(name, surname, country, role, id)
        else:
            if not id:
                flash(
                    "You need to select the competitor you want to update using the radio buttons!"
                )
            if not name or not surname:
                flash("You need to enter a name and a surname!")
            return page.show_page_comp()
    elif 'Reset' in request.form:
        return page.reset_table()
Exemplo n.º 4
0
def uwp_comp():
    dsn = app.config['dsn']
    page = UWP(dsn)
    if request.method == 'GET':
        return page.show_page_comp()
    elif 'Add' in request.form:
        name = request.form['Name']
        surname = request.form['Surname']
        country = request.form['Country']
        role = request.form['Role']
        if name and surname:
            return page.add_competitor(name, surname, country, role)
        else:
            flash("You need to enter a name and a surname!")
            return page.show_page_comp()
    elif 'Delete' in request.form:
        id = request.form.get('select', '')
        if id:
            return page.delete_competitor(id)
        else:
            flash("You need to select the competitor you want to delete using the radio buttons!")
            return page.show_page_comp()

    elif 'Update' in request.form:
        id = request.form.get('select', '')
        name = request.form['Name']
        surname = request.form['Surname']
        country = request.form['Country']
        role = request.form['Role']
        if id and name and surname:
            return page.update_competitor(name, surname, country, role, id)
        else:
            if not id:
                flash("You need to select the competitor you want to update using the radio buttons!")
            if not name or not surname:
                flash("You need to enter a name and a surname!")
            return page.show_page_comp()
    elif 'Reset' in request.form:
        return page.reset_table()
Exemplo n.º 5
0
 def __init__(self):
     self.name          = random.choice(("Erehwemos", "Lacipyt"))
     self.starport      = self._generate_starport()
     self.contents      = self._generate_contents()
     self.size          = self._generate_size()
     self.atmosphere    = self._generate_atmosphere()
     self.hydrographics = self._generate_hydrographics()
     self.population    = self._generate_population()
     self.government    = self._generate_government()
     self.law_level     = self._generate_law_level()
     self.tech_level    = self._generate_tech_level()
     self.uwp           = UWP(self.starport, self.size, self.atmosphere,
                              self.hydrographics, self.population,
                              self.government, self.law_level,
                              self.tech_level)
     self.trade_classes = self._generate_trade_classes()
     self.bases         = self._generate_bases()
     self.gas_giant     = self._generate_gas_giant()
Exemplo n.º 6
0
 def __init__(self, name, starport, contents, size, atmosphere, 
              hydrographics, population, government, law_level, tech_level):
     self.name          = name
     self.starport      = starport
     self.contents      = contents
     self.size          = size
     self.atmosphere    = atmosphere
     self.hydrographics = hydrographics
     self.population    = population
     self.government    = government
     self.law_level     = law_level
     self.tech_level    = tech_level
     self.uwp           = UWP(self.starport, self.size, self.atmosphere,
                              self.hydrographics, self.population,
                              self.government, self.law_level,
                              self.tech_level)
     self.trade_classes = self._generate_trade_classes()
     self.bases         = self._generate_bases()
     self.gas_giant     = self._generate_gas_giant()