Last active
August 29, 2015 13:59
-
-
Save tupy/10475935 to your computer and use it in GitHub Desktop.
Minicurso Python na Copa - Python Day Feira de Santana
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link href="{{url_for('static', filename='css/bolao.css')}}" rel="stylesheet" /> | |
{% block css %}{% endblock %} | |
{% block js %}{% endblock %} | |
</head> | |
<body> | |
<div id="content"> | |
{% block content %} | |
{% endblock %} | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'base.html' %} | |
{% block content %} | |
<table class="table"> | |
{% for jogo in jogos -%} | |
<tr> | |
<td class="text-right">{{jogo.selecaoA.sigla}}<img class="flag" src="{{url_for('static', filename='images/flags/%s.png'%jogo.selecaoA.sigla)}}" width="30" height="30" alt="{{jogo.selecaoA}}" /></td> | |
<td class="placar">{{ '%d x %d' % (jogo.placarA, jogo.placarB) if jogo.placarA is number else 'x'}}</td> | |
<td><img class="flag" src="{{url_for('static', filename='images/flags/%s.png'%jogo.selecaoB.sigla)}}" width="30" height="30" alt="{{jogo.selecaoB}}" />{{jogo.selecaoB.sigla}}</td> | |
</tr> | |
<tr class="date"> | |
<td colspan="3"><small>{{jogo.datahora}}</small></td> | |
</tr> | |
{% endfor %} | |
</table> | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% extends 'base.html' %} | |
{% block content %} | |
<table class="table"> | |
{% for jogo in jogos -%} | |
<tr> | |
<td class="text-right">{{jogo.selecaoA.sigla}}<img class="flag" src="{{url_for('static', filename='images/flags/%s.png'%jogo.selecaoA.sigla)}}" width="30" height="30" alt="{{jogo.selecaoA}}" /></td> | |
<td class="placar">{{ '%d x %d' % (jogo.placarA, jogo.placarB) if jogo.placarA is number else 'x'}}<br /> | |
{% set aposta = apostas[jogo.id] -%} | |
<small><a href="{{url_for('.aposta_jogo_view', jogo_id=jogo.id)}}">{{aposta.placarA}} x {{aposta.placarB}}</a></small> | |
{%- else %} | |
<small><a href="{{url_for('.aposta_jogo_view', jogo_id=jogo.id)}}">apostar</a></small> | |
{%- endif %} | |
</td> | |
<td><img class="flag" src="{{url_for('static', filename='images/flags/%s.png'%jogo.selecaoB.sigla)}}" width="30" height="30" alt="{{jogo.selecaoB}}" />{{jogo.selecaoB.sigla}}</td> | |
</tr> | |
<tr class="date"> | |
<td colspan="3"><small>{{jogo.datahora}}</small></td> | |
</tr> | |
{% endfor %} | |
</table> | |
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# edit main.py | |
def configure_admin(app): | |
from flask.ext.admin import Admin | |
from flask.ext.admin.contrib.sqla import ModelView | |
from .database import db | |
from .models import Selecao, Jogo | |
admin = Admin(app) | |
admin.add_view(ModelView(Selecao, db.session)) | |
admin.add_view(ModelView(Jogo, db.session)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment