Commits

Kenneth Love  committed e793e0d

made db select a number field

  • Participants
  • Parent commits e17e11d

Comments (0)

Files changed (3)

     r = get_redis_connection(session)
     return dict(db_size=r.dbsize())
 
-@app.context_processor
-def get_number_of_dbs():
-    r = get_redis_connection(session)
-    dbs = [int(key[2:]) for key in r.info().keys() if key.startswith('db')]
-    dbs.sort()
-    return dict(db_range=xrange(0, dbs[-1]+1))
-
 @app.route('/new', methods=['GET', 'POST'])
 def new_key():
     form = StringForm(request.form or None)

File static/css/style.css

   #switch_db fieldset {
     overflow:hidden;
   }
-  #switch_db select { vertical-align:baseline; }
+  #switch_db input {
+    vertical-align:baseline;
+    width:5em;
+  }
   #switch_db label {
     color:rgb(133, 27, 31);
     font-size:18px;

File templates/layout.html

 	<form action="{{ url_for('change_db') }}" method="post" id="switch_db">
 		<fieldset>
 			<label for="id_redis_db">Current Redis DB:</label>
-			<select id="id_redis_db" name="redis_db">
-				{% for number in db_range %}
-				<option value="{{ number }}" {% if number == session.redis_db %}selected{% endif %}>{{ number }}</option>
-				{% endfor %}
-			</select>
+			<input type="number" name="redis_db" id="id_redis_db" value="{{ session.redis_db }}">
 			<a href="/new" id="new_key">New Key</a>
 		</fieldset>
 	</form>