From 1e971e8fd342724c637d4f1c4e59a6d7c47ff829 Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Fri, 22 Jan 2021 19:35:22 +0100 Subject: [PATCH] ### 0.0.11 Release * Issue #43 /europe/date_reported * Issue #44 /europe/continent * Issue #45 /europe/country * Issue #46 /europe/data * Issue #39 SQLalchemy instead of SQL: AllModelClasses.remove_all() * Issue #40 SQLalchemy instead of SQL: EuropeDataImportTable.get_date_rep() * Issue #41 SQLalchemy instead of SQL: EuropeDataImportTable.get_countries_of_continent() * Issue #42 SQLalchemy instead of SQL: WhoGlobalDataImportTable.get_new_dates_as_array() * Issue #47 refactor Routes from app.py to org...who,europe,... * Issue #48 refactor Tasks from server_mq.py to org...who,europe,... * Issue #49 EuropeServiceUpdate.__update_data_short() * Issue #50 remove unused requirements from requirements.txt --- README.md | 1 + app.py | 26 +++++-- org/woehlke/covid19/europe/europe_model.py | 4 ++ requirements.txt | 26 +++---- templates/europe/europe_continent_all.html | 4 +- templates/europe/europe_continent_one.html | 71 +++++++++++++++++++ templates/europe/europe_country_all.html | 28 +------- templates/europe/europe_country_one.html | 2 +- templates/europe/europe_data.html | 33 +-------- .../europe/europe_date_reported_all.html | 17 ++--- .../europe/europe_date_reported_one.html | 2 +- .../europe/fragment_europe_country_table.html | 35 +++++++++ ...e.html => fragment_europe_data_table.html} | 2 +- templates/fragment_navtabs_europe.html | 6 +- templates/who/fragment_who_country_table.html | 18 +++++ .../who/fragment_who_global_data_table.html | 44 ++++++++++++ templates/who/who_country_all.html | 19 +---- templates/who/who_country_germany.html | 29 +------- templates/who/who_country_one.html | 29 +------- templates/who/who_date_reported_all.html | 7 +- templates/who/who_date_reported_one.html | 38 ++-------- templates/who/who_region_one.html | 19 +---- 22 files changed, 241 insertions(+), 219 deletions(-) create mode 100644 templates/europe/europe_continent_one.html create mode 100644 templates/europe/fragment_europe_country_table.html rename templates/europe/{europe_data_table.html => fragment_europe_data_table.html} (97%) create mode 100644 templates/who/fragment_who_country_table.html create mode 100644 templates/who/fragment_who_global_data_table.html diff --git a/README.md b/README.md index 49ce08f7..a289887c 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ class WhoGlobalDataImportTable(db.Model): * Issue #47 refactor Routes from app.py to org...who,europe,... * Issue #48 refactor Tasks from server_mq.py to org...who,europe,... * Issue #49 EuropeServiceUpdate.__update_data_short() +* Issue #50 remove unused requirements from requirements.txt ### 0.0.12 Release * Issue #5 Visual Graphs for Data per Countries order by Date diff --git a/app.py b/app.py index 471f8ddb..d425cbb7 100644 --- a/app.py +++ b/app.py @@ -272,9 +272,9 @@ def url_europe_data_imported(page=1): page_info=page_info) -@app.route('/europe/date_reported/page/<int:page>') -@app.route('/europe/date_reported') -def url_europe_date_reported(page=1): +@app.route('/europe/date_reported/all/page/<int:page>') +@app.route('/europe/date_reported/all') +def url_europe_date_reported_all(page=1): page_info = ApplicationPage('Europe', "date_reported") page_data = EuropeDateReported.get_all_as_page(page) return render_template( @@ -296,9 +296,9 @@ def url_europe_date_reported_one(europe_date_reported_id, page=1): page_info=page_info) -@app.route('/europe/continent/page/<int:page>') -@app.route('/europe/continent') -def url_europe_continent(page=1): +@app.route('/europe/continent/all/page/<int:page>') +@app.route('/europe/continent/all') +def url_europe_continent_all(page=1): page_info = ApplicationPage('Europe', "continent") page_data = EuropeContinent.get_all_as_page(page) return render_template( @@ -307,6 +307,20 @@ def url_europe_continent(page=1): page_info=page_info) + +@app.route('/europe/continent/<int:continent_id>/page/<int:page>') +@app.route('/europe/continent/<int:continent_id>') +def url_europe_continent_one(continent_id, page=1): + page_info = ApplicationPage('Europe', "continent") + continent = EuropeContinent.get_by_id(continent_id) + page_data = EuropeCountry.find_by_continent(continent, page) + return render_template( + 'europe/europe_continent_all.html', + continent=continent, + page_data=page_data, + page_info=page_info) + + @app.route('/europe/country/all/page/<int:page>') @app.route('/europe/country/all') def url_europe_country_all(page=1): diff --git a/org/woehlke/covid19/europe/europe_model.py b/org/woehlke/covid19/europe/europe_model.py index a77d8025..03ab1c5b 100644 --- a/org/woehlke/covid19/europe/europe_model.py +++ b/org/woehlke/covid19/europe/europe_model.py @@ -178,6 +178,10 @@ class EuropeCountry(db.Model): (cls.country_territory_code == country_territory_code) )).one() + @classmethod + def find_by_continent(cls, continent, page): + return db.session.query(cls).filter(cls.continent_id == continent.id).paginate(page, per_page=ITEMS_PER_PAGE) + class EuropeData(db.Model): __tablename__ = 'europe_data' diff --git a/requirements.txt b/requirements.txt index db3cf397..936553a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,10 +6,10 @@ packaging==20.8 # Flask # Flask==1.1.2 -Flask-Admin==1.5.7 +#Flask-Admin==1.5.7 Flask-DB==0.3.0 -Flask-Migrate==2.6.0 -flask-restx==0.2.0 +#Flask-Migrate==2.6.0 +#flask-restx==0.2.0 Flask-SQLAlchemy==2.4.4 SQLAlchemy==1.3.22 SQLAlchemy-Utils==0.36.8 @@ -19,18 +19,12 @@ Werkzeug==1.0.1 # Flask extras # flask-paginate==0.8.0 -simplejson==3.17.2 -blinker==1.4 +#simplejson==3.17.2 +#blinker==1.4 python-dotenv==0.15.0 watchdog==1.0.2 flask-cors==3.0.10 # -# -# -tokenize-rt==4.0.0 -numpy==1.19.5 -pandas==1.2.1 -# # PostgreSQL # psycopg2==2.8.6 @@ -42,5 +36,11 @@ celery[redis]==5.0.5 # # Frontend # -pyecharts==1.9.0 -pyecharts-extras==0.0.5 \ No newline at end of file +#pyecharts==1.9.0 +#pyecharts-extras==0.0.5 +# +# +# +#tokenize-rt==4.0.0 +#numpy==1.19.5 +#pandas==1.2.1 \ No newline at end of file diff --git a/templates/europe/europe_continent_all.html b/templates/europe/europe_continent_all.html index c3db4ff0..a8ca9527 100644 --- a/templates/europe/europe_continent_all.html +++ b/templates/europe/europe_continent_all.html @@ -57,7 +57,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> + <table class="table table-hover table-striped table-dark"> <thead> <tr> <th scope="col">continent</th> @@ -66,7 +66,7 @@ <tbody> {% for europe_continent in page_data.items %} <tr> - <td>{{ europe_continent.continent_exp }}</td> + <td><a href="/europe/continent/{{ europe_continent.id }}">{{ europe_continent.continent_exp }}</a></td> </tr> {% endfor %} </tbody> diff --git a/templates/europe/europe_continent_one.html b/templates/europe/europe_continent_one.html new file mode 100644 index 00000000..f642f3ef --- /dev/null +++ b/templates/europe/europe_continent_one.html @@ -0,0 +1,71 @@ +{% extends 'page_layout.html' %} + +{% block navigation_breadcrumb %} + <nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="/">Home</a></li> + <li class="breadcrumb-item"><a href="/who/region/all">Regions</a></li> + <li class="breadcrumb-item active" aria-current="page">TBD</li> + </ol> + </nav> +{% endblock %} + +{% block navigation_navtabs %} + {% include 'fragment_navtabs_europe.html' %} +{% endblock %} + +{% block main_container %} + + {% if page_data.pages > 1 %} + <ul class="pagination"> + {% if page_data.has_prev %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_continent', page=page_data.prev_num) }}"> + Previous + </a> + </li> + {% endif %} + {% for page_num in page_data.iter_pages() %} + {% if page_num %} + {% if page_num != page_data.page %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_continent', page=page_num) }}"> + {{ page_num }} + </a> + </li> + {% else %} + <li class="page-item active"> + <a class="page-link" href="#">{{ page_num }}</a> + </li> + {% endif %} + {% else %} + <li class="page-item"> + <span class="ellipsis page-link my-page-item-ellipsis-page-link">…</span> + </li> + {% endif %} + {% endfor %} + {% if page_data.has_next %} + <li class="page-item"> + <a class="page-link" + href="{{ url_for( 'url_europe_continent', page=page_data.next_num) }}"> + Next + </a> + </li> + {% endif %} + </ul> + {% endif %} + + {% include 'europe/fragment_europe_country_table.html' %} + +{% endblock %} + + +{% block footer_container %} + <div> + {% for error in errors %} + <h4>{{ error }}</h4> + {% endfor %} + </div> +{% endblock %} \ No newline at end of file diff --git a/templates/europe/europe_country_all.html b/templates/europe/europe_country_all.html index 7427d42a..7044d9b6 100644 --- a/templates/europe/europe_country_all.html +++ b/templates/europe/europe_country_all.html @@ -57,33 +57,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">countries_and_territories</th> - <th scope="col">pop_data_2019</th> - <th scope="col">geo_id</th> - <th scope="col">country_territory_code</th> - <th scope="col">continent</th> - </tr> - </thead> - <tbody> - {% for europe_country in page_data.items %} - <tr> - <td> - <a href="/europe/country/{{ europe_country.id }}"> - {{ europe_country.countries_and_territories }}</a></td> - <td>{{ europe_country.pop_data_2019 }}</td> - <td><a href="/europe/country/{{ europe_country.id }}"> - {{ europe_country.geo_id }}</a></td> - <td><a href="/europe/country/{{ europe_country.id }}"> - {{ europe_country.country_territory_code }}</a></td> - <td><a href="/europe/continent/{{ europe_country.continent.id }}"> - {{ europe_country.continent.continent_exp }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'europe/fragment_europe_country_table.html' %} {% endblock %} diff --git a/templates/europe/europe_country_one.html b/templates/europe/europe_country_one.html index 53aa7c4b..cb1e856f 100644 --- a/templates/europe/europe_country_one.html +++ b/templates/europe/europe_country_one.html @@ -52,7 +52,7 @@ </ul> {% endif %} - {% include 'europe/europe_data_table.html' %} + {% include 'europe/fragment_europe_data_table.html' %} {% endblock %} diff --git a/templates/europe/europe_data.html b/templates/europe/europe_data.html index e2ce09c0..f4f19542 100644 --- a/templates/europe/europe_data.html +++ b/templates/europe/europe_data.html @@ -57,38 +57,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">date_rep</th> - <th scope="col">year_week</th> - <th scope="col">deaths_weekly</th> - <th scope="col">cases_weekly</th> - <th scope="col">notification_rate_per_100000_population_14days</th> - <th scope="col">countries_and_territories</th> - <th scope="col">pop_data_2019</th> - <th scope="col">geo_id</th> - <th scope="col">country_territory_code</th> - <th scope="col">continent</th> - </tr> - </thead> - <tbody> - {% for europe_data in page_data.items %} - <tr> - <td>{{ europe_data.europe_date_reported.date_rep }}</td> - <td>{{ europe_data.europe_date_reported.year_week }}</td> - <td>{{ europe_data.deaths_weekly }}</td> - <td>{{ europe_data.cases_weekly }}</td> - <td>{{ europe_data.notification_rate_per_100000_population_14days }}</td> - <td>{{ europe_data.europe_country.countries_and_territories }}</td> - <td>{{ europe_data.europe_country.pop_data_2019 }}</td> - <td>{{ europe_data.europe_country.geo_id }}</td> - <td>{{ europe_data.europe_country.country_territory_code }}</td> - <td>{{ europe_data.europe_country.continent.continent_exp }}</td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'europe/fragment_europe_data_table.html' %} {% endblock %} diff --git a/templates/europe/europe_date_reported_all.html b/templates/europe/europe_date_reported_all.html index 872be3cd..e65ab6d9 100644 --- a/templates/europe/europe_date_reported_all.html +++ b/templates/europe/europe_date_reported_all.html @@ -21,7 +21,7 @@ {% if page_data.has_prev %} <li class="page-item"> <a class="page-link" - href="{{ url_for( 'url_europe_date_reported', page=page_data.prev_num) }}"> + href="{{ url_for( 'url_europe_date_reported_all', page=page_data.prev_num) }}"> Previous </a> </li> @@ -31,7 +31,7 @@ {% if page_num != page_data.page %} <li class="page-item"> <a class="page-link" - href="{{ url_for( 'url_europe_date_reported', page=page_num) }}"> + href="{{ url_for( 'url_europe_date_reported_all', page=page_num) }}"> {{ page_num }} </a> </li> @@ -49,7 +49,7 @@ {% if page_data.has_next %} <li class="page-item"> <a class="page-link" - href="{{ url_for( 'url_europe_date_reported', page=page_data.next_num) }}"> + href="{{ url_for( 'url_europe_date_reported_all', page=page_data.next_num) }}"> Next </a> </li> @@ -57,18 +57,19 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> + <table class="table table-hover table-striped table-dark"> <thead> <tr> - <th scope="col">date_rep</th> - <th scope="col">year_week</th> + <th scope="col">date reported</th> + <th scope="col">year week</th> </tr> </thead> <tbody> {% for europe_date_reported in page_data.items %} <tr> - <td><a href="/europe/date_reported/{{ europe_date_reported.id }}">{{ europe_date_reported.date_rep }}</a></td> - <td>{{ europe_date_reported.year_week }}</td> + <th>{{ europe_date_reported.date_rep }}</th> + <td><a href="/europe/date_reported/{{ europe_date_reported.id }}"> + {{ europe_date_reported.year_week }}</a></td> </tr> {% endfor %} </tbody> diff --git a/templates/europe/europe_date_reported_one.html b/templates/europe/europe_date_reported_one.html index f34943d5..6c18afea 100644 --- a/templates/europe/europe_date_reported_one.html +++ b/templates/europe/europe_date_reported_one.html @@ -55,7 +55,7 @@ </ul> {% endif %} - {% include 'europe/europe_data_table.html' %} + {% include 'europe/fragment_europe_data_table.html' %} {% endblock %} diff --git a/templates/europe/fragment_europe_country_table.html b/templates/europe/fragment_europe_country_table.html new file mode 100644 index 00000000..b21d0696 --- /dev/null +++ b/templates/europe/fragment_europe_country_table.html @@ -0,0 +1,35 @@ + + <table class="table table-hover table-striped table-dark"> + <thead> + <tr> + <th scope="col">countries and territories</th> + <th scope="col">population data 2019</th> + <th scope="col">geo id</th> + <th scope="col">country territory code</th> + <th scope="col">continent</th> + </tr> + </thead> + <tbody> + {% for europe_country in page_data.items %} + <tr> + <td> + <a href="/europe/country/{{ europe_country.id }}"> + {{ europe_country.countries_and_territories }}</a> + </td> + <td>{{ europe_country.pop_data_2019 }}</td> + <td> + <a href="/europe/country/{{ europe_country.id }}"> + {{ europe_country.geo_id }}</a> + </td> + <td> + <a href="/europe/country/{{ europe_country.id }}"> + {{ europe_country.country_territory_code }}</a> + </td> + <td> + <a href="/europe/continent/{{ europe_country.continent.id }}"> + {{ europe_country.continent.continent_exp }}</a> + </td> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file diff --git a/templates/europe/europe_data_table.html b/templates/europe/fragment_europe_data_table.html similarity index 97% rename from templates/europe/europe_data_table.html rename to templates/europe/fragment_europe_data_table.html index 1f85f333..c56001e7 100644 --- a/templates/europe/europe_data_table.html +++ b/templates/europe/fragment_europe_data_table.html @@ -7,7 +7,7 @@ <th scope="col">cases weekly</th> <th scope="col">notification rate per 100000 population 14days</th> <th scope="col">countries and territories</th> - <th scope="col">pop data 2019</th> + <th scope="col">population data 2019</th> <th scope="col">geo id</th> <th scope="col">country territory code</th> <th scope="col">continent</th> diff --git a/templates/fragment_navtabs_europe.html b/templates/fragment_navtabs_europe.html index 73aa49a1..46ac5103 100644 --- a/templates/fragment_navtabs_europe.html +++ b/templates/fragment_navtabs_europe.html @@ -7,13 +7,13 @@ <a class="nav-link" href="/europe/info">Europe Info</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/date_reported">Europe date_reported</a> + <a class="nav-link" href="/europe/date_reported/all">Europe date_reported</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/continent">Europe continent</a> + <a class="nav-link" href="/europe/continent/all">Europe continent</a> </li> <li class="nav-item"> - <a class="nav-link" href="/europe/country">Europe country</a> + <a class="nav-link" href="/europe/country/all">Europe country</a> </li> <li class="nav-item"> <a class="nav-link" href="/europe/data">Europe data</a> diff --git a/templates/who/fragment_who_country_table.html b/templates/who/fragment_who_country_table.html new file mode 100644 index 00000000..c5954864 --- /dev/null +++ b/templates/who/fragment_who_country_table.html @@ -0,0 +1,18 @@ + <table class="table table-hover table-striped table-dark"> + <thead> + <tr> + <th scope="col">country code</th> + <th scope="col">country</th> + <th scope="col">who region</th> + </tr> + </thead> + <tbody> + {% for who_country in page_data.items %} + <tr> + <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country_code }}</a></td> + <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country }}</a></td> + <th><a href="/who/region/{{ who_country.region.id }}">{{ who_country.region.region }}</a></th> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file diff --git a/templates/who/fragment_who_global_data_table.html b/templates/who/fragment_who_global_data_table.html new file mode 100644 index 00000000..066a0c63 --- /dev/null +++ b/templates/who/fragment_who_global_data_table.html @@ -0,0 +1,44 @@ + <table class="table table-hover table-striped"> + <thead> + <tr> + <th scope="col">date reported</th> + <th scope="col">deaths new</th> + <th scope="col">cases new</th> + <th scope="col">deaths cumulative</th> + <th scope="col">cases cumulative</th> + <th scope="col">country code</th> + <th scope="col">country</th> + <th scope="col">region</th> + </tr> + </thead> + <tbody> + {% for who_global_data in page_data.items %} + <tr> + <th> + <a href="/who/date_reported/{{ who_global_data.date_reported.id }}"> + {{ who_global_data.date_reported.date_reported }} + </a> + </th> + <td>{{ who_global_data.deaths_new }}</td> + <td>{{ who_global_data.cases_new }}</td> + <td>{{ who_global_data.deaths_cumulative }}</td> + <td>{{ who_global_data.cases_cumulative }}</td> + <td> + <a href="/who/country/{{ who_global_data.country.id }}"> + {{ who_global_data.country.country_code }} + </a> + </td> + <td> + <a href="/who/country/{{ who_global_data.country.id }}"> + {{ who_global_data.country.country }} + </a> + </td> + <th> + <a href="/who/region/{{ who_global_data.country.region.id }}"> + {{ who_global_data.country.region.region }} + </a> + </th> + </tr> + {% endfor %} + </tbody> + </table> \ No newline at end of file diff --git a/templates/who/who_country_all.html b/templates/who/who_country_all.html index 0b0b5435..9cc87840 100644 --- a/templates/who/who_country_all.html +++ b/templates/who/who_country_all.html @@ -50,24 +50,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">country_code</th> - <th scope="col">country</th> - <th scope="col">who_region</th> - </tr> - </thead> - <tbody> - {% for who_country in page_data.items %} - <tr> - <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country_code }}</a></td> - <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country }}</a></td> - <td><a href="/who/region/{{ who_country.region.id }}">{{ who_country.region.region }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'who/fragment_who_country_table.html' %} {% endblock %} diff --git a/templates/who/who_country_germany.html b/templates/who/who_country_germany.html index 5cebc224..1b719585 100644 --- a/templates/who/who_country_germany.html +++ b/templates/who/who_country_germany.html @@ -57,34 +57,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">date_reported</th> - <th scope="col">deaths_new</th> - <th scope="col">cases_new</th> - <th scope="col">deaths_cumulative</th> - <th scope="col">cases_cumulative</th> - <th scope="col">country_code</th> - <th scope="col">country</th> - <th scope="col">region</th> - </tr> - </thead> - <tbody> - {% for who_global_data in page_data.items %} - <tr> - <td><a href="/who/date_reported/{{ who_global_data.date_reported.id }}">{{ who_global_data.date_reported.date_reported }}</a></td> - <td>{{ who_global_data.deaths_new }}</td> - <td>{{ who_global_data.cases_new }}</td> - <td>{{ who_global_data.deaths_cumulative }}</td> - <td>{{ who_global_data.cases_cumulative }}</td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country_code }}</a></td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country }}</a></td> - <td><a href="/who/region/{{ who_global_data.country.region.id }}">{{ who_global_data.country.region.region }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'who/fragment_who_global_data_table.html' %} {% endblock %} diff --git a/templates/who/who_country_one.html b/templates/who/who_country_one.html index 2c37d19a..cb7d837b 100644 --- a/templates/who/who_country_one.html +++ b/templates/who/who_country_one.html @@ -57,34 +57,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">date_reported</th> - <th scope="col">deaths_new</th> - <th scope="col">cases_new</th> - <th scope="col">deaths_cumulative</th> - <th scope="col">cases_cumulative</th> - <th scope="col">country_code</th> - <th scope="col">country</th> - <th scope="col">region</th> - </tr> - </thead> - <tbody> - {% for who_global_data in page_data.items %} - <tr> - <td><a href="/who/date_reported/{{ who_global_data.date_reported.id }}">{{ who_global_data.date_reported.date_reported }}</a></td> - <td>{{ who_global_data.deaths_new }}</td> - <td>{{ who_global_data.cases_new }}</td> - <td>{{ who_global_data.deaths_cumulative }}</td> - <td>{{ who_global_data.cases_cumulative }}</td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country_code }}</a></td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country }}</a></td> - <td><a href="/who/region/{{ who_global_data.country.region.id }}">{{ who_global_data.country.region.region }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'who/fragment_who_global_data_table.html' %} {% endblock %} diff --git a/templates/who/who_date_reported_all.html b/templates/who/who_date_reported_all.html index 2e6fc353..c768eadb 100644 --- a/templates/who/who_date_reported_all.html +++ b/templates/who/who_date_reported_all.html @@ -59,8 +59,11 @@ <tbody> {% for who_date_reported in page_data.items %} <tr> - <td><a href="/who/date_reported/{{ who_date_reported.id }}">{{ who_date_reported.date_reported }}</a></td> - + <td> + <a href="/who/date_reported/{{ who_date_reported.id }}"> + {{ who_date_reported.date_reported }} + </a> + </td> </tr> {% endfor %} </tbody> diff --git a/templates/who/who_date_reported_one.html b/templates/who/who_date_reported_one.html index abca1cc7..9ddad9e1 100644 --- a/templates/who/who_date_reported_one.html +++ b/templates/who/who_date_reported_one.html @@ -24,7 +24,8 @@ <ul class="pagination"> {% if page_data.has_prev %} <li class="page-item"> - <a class="page-link" href="{{ url_for('url_who_date_reported', date_reported_id=who_date_reported.id, page=page_data.prev_num) }}">Previous</a> + <a class="page-link" href="{{ url_for('url_who_date_reported', + date_reported_id=who_date_reported.id, page=page_data.prev_num) }}">Previous</a> </li> {% endif %} <!-- all page numbers --> @@ -32,7 +33,8 @@ {% if page_num %} {% if page_num != page_data.page %} <li class="page-item"> - <a class="page-link" href="{{ url_for('url_who_date_reported', date_reported_id=who_date_reported.id, page=page_num) }}">{{ page_num }}</a> + <a class="page-link" href="{{ url_for('url_who_date_reported', + date_reported_id=who_date_reported.id, page=page_num) }}">{{ page_num }}</a> </li> {% else %} <li class="page-item active"> @@ -48,40 +50,14 @@ <!-- next page --> {% if page_data.has_next %} <li class="page-item"> - <a class="page-link" href="{{ url_for('url_who_date_reported', date_reported_id=who_date_reported.id, page=page_data.next_num) }}">Next</a> + <a class="page-link" href="{{ url_for('url_who_date_reported', + date_reported_id=who_date_reported.id, page=page_data.next_num) }}">Next</a> </li> {% endif %} </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">date_reported</th> - <th scope="col">deaths_new</th> - <th scope="col">cases_new</th> - <th scope="col">deaths_cumulative</th> - <th scope="col">cases_cumulative</th> - <th scope="col">country_code</th> - <th scope="col">country</th> - <th scope="col">region</th> - </tr> - </thead> - <tbody> - {% for who_global_data in page_data.items %} - <tr> - <td><a href="/who/date_reported/{{ who_global_data.date_reported.id }}">{{ who_global_data.date_reported.date_reported }}</a></td> - <td>{{ who_global_data.deaths_new }}</td> - <td>{{ who_global_data.cases_new }}</td> - <td>{{ who_global_data.deaths_cumulative }}</td> - <td>{{ who_global_data.cases_cumulative }}</td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country_code }}</a></td> - <td><a href="/who/country/{{ who_global_data.country.id }}">{{ who_global_data.country.country }}</a></td> - <td><a href="/who/region/{{ who_global_data.country.region.id }}">{{ who_global_data.country.region.region }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'who/fragment_who_global_data_table.html' %} {% endblock %} diff --git a/templates/who/who_region_one.html b/templates/who/who_region_one.html index 53f2c9be..8aa93cd6 100644 --- a/templates/who/who_region_one.html +++ b/templates/who/who_region_one.html @@ -51,24 +51,7 @@ </ul> {% endif %} - <table class="table table-hover table-striped"> - <thead> - <tr> - <th scope="col">country_code</th> - <th scope="col">country</th> - <th scope="col">region</th> - </tr> - </thead> - <tbody> - {% for who_country in page_data.items %} - <tr> - <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country_code }}</a></td> - <td><a href="/who/country/{{ who_country.id }}">{{ who_country.country }}</a></td> - <td><a href="/who/region/{{ who_country.region.id }}">{{ who_country.region.region }}</a></td> - </tr> - {% endfor %} - </tbody> - </table> + {% include 'who/fragment_who_country_table.html' %} {% endblock %} -- GitLab