Skip to content

Commit 2d6d99b

Browse files
committed
remove flask_mobility replace with css media query
1 parent 4ba2606 commit 2d6d99b

File tree

2 files changed

+15
-21
lines changed

2 files changed

+15
-21
lines changed

flaskhello.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@
99
# import html
1010
# import multiprocessing
1111

12-
from flask_mobility import Mobility
1312
from flask import Flask, render_template, Markup, request
1413
from flask_caching import Cache
1514
from wtforms import Form, BooleanField, FormField, FieldList, StringField, IntegerField, validators, SelectField
1615

1716
http = urllib3.PoolManager()
1817

1918
g_app = Flask(__name__)
20-
Mobility(g_app)
2119
application = g_app
2220

2321
# from flask_table import Table, Col
@@ -179,12 +177,8 @@ def index():
179177

180178
page_order_s = str(page_order)
181179

182-
suffix = ""
183-
if request.MOBILE:
184-
suffix = ":MOBILE"
185-
186180
if page_order_s == g_standard_order_s:
187-
full_page = g_c.Get(page_order_s + suffix)
181+
full_page = g_c.Get(page_order_s)
188182
if full_page is not None:
189183
return full_page
190184

@@ -263,7 +257,7 @@ def index():
263257
page = render_template('page.html', columns = result)
264258

265259
if page_order_s == g_standard_order_s:
266-
g_c.Put(page_order_s + suffix, page, timeout = EXPIRE_MINUTES)
260+
g_c.Put(page_order_s, page, timeout = EXPIRE_MINUTES)
267261
return page
268262

269263
class ROStringField(StringField):

templates/page.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@
1818
margin-bottom: .4em;
1919
}
2020

21-
{% if not request.MOBILE %}
22-
/* Create three equal columns that floats next to each other */
23-
.column {
24-
float: left;
25-
width: 33.33%;
26-
padding: 10px;
21+
@media screen and (min-width: 769px) {
22+
/* Create three equal columns that floats next to each other */
23+
.column {
24+
float: left;
25+
width: 33.33%;
26+
padding: 10px;
27+
}
28+
29+
.row:after {
30+
content: "";
31+
display: table;
32+
clear: both;
33+
}
2734
}
28-
29-
.row:after {
30-
content: "";
31-
display: table;
32-
clear: both;
33-
}
34-
{% endif %}
3535

3636
</style>
3737

0 commit comments

Comments
 (0)