Skip to content

Instantly share code, notes, and snippets.

@pedrohsbarbosa99
Created October 19, 2020 22:19
Show Gist options
  • Save pedrohsbarbosa99/2476b980778e9d6d4e173ea9c06989aa to your computer and use it in GitHub Desktop.
Save pedrohsbarbosa99/2476b980778e9d6d4e173ea9c06989aa to your computer and use it in GitHub Desktop.
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Previsão do Tempo</title>
<link crossorigin="anonymous"
href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.min.css"
integrity="sha256-8B1OaG0zT7uYA572S2xOxWACq9NXYPQ+U5kHPV1bJN4="
rel="stylesheet"/>
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
<body>
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th>Temperatura</th>
<th>Dia ou Noite?</th>
<th>Data</th>
<th>Atualizado em:</th>
<th>Descrição</th>
<th>cidade</th>
<th>humidade</th>
<th>Velocidade do Vento</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ data.temp }}</td>
<td>{{ data.currently }}</td>
<td>{{ data.date }}</td>
<td>{{ data.time }}</td>
<td>{{ data.description }}</td>
<td>{{ data.city_name }}</td>
<td>{{ data.humidity }}</td>
<td>{{ data.wind_speedy }}</td>
</tr>
</tbody>
</table>
<table class="table is-fullwidth is-striped is-bordered">
<thead>
<tr>
<th>Data</th>
<th>Minima</th>
<th>Maxima</th>
<th>Previsão</th>
</tr>
</thead>
<tbody>
{% for d in data1 %}
<tr>
<td>{{ d.date }}</td>
<td>{{ d.min }}</td>
<td>{{ d.max }}</td>
<td>{{ d.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<img id='imagem'>
<script>
caminho_imagem = 'http://assets.api.hgbrasil.com/weather/images/' + '{{ data.img_id }}' + '.png'
document.getElementById('imagem').src = caminho_imagem
</script>
</html>
from django.views.generic import TemplateView
from .services import get_tempo, next_days
class GetTempo(TemplateView):
template_name = 'tempo.html'
def get_context_data(self, *args, **kwargs):
context = {
'data' : get_tempo(),
'data1' : next_days(),
}
return context
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment