use flask-bootstrap util to display flashed messages
This commit is contained in:
		
							parent
							
								
									32dc3a9581
								
							
						
					
					
						commit
						d3a3467fee
					
				
					 2 changed files with 4 additions and 9 deletions
				
			
		|  | @ -28,10 +28,10 @@ def download(): | ||||||
|         form.start_time.data = datetime.now() - timedelta(hours=1) |         form.start_time.data = datetime.now() - timedelta(hours=1) | ||||||
|         form.length.data = 60 |         form.length.data = 60 | ||||||
|     elif form.validate_on_submit(): |     elif form.validate_on_submit(): | ||||||
|         flash('The download should start immediately.') |         flash('The download should start immediately.', 'success') | ||||||
|         return render_template('download.html', form=form, filename='test.mp3') |         return render_template('download.html', form=form, filename='test.mp3') | ||||||
|     else: |     else: | ||||||
|         flash('Error') |         flash('Error', 'warning') | ||||||
|     return render_template('download.html', form=form) |     return render_template('download.html', form=form) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,16 +1,11 @@ | ||||||
| {% extends "bootstrap/base.html" %} | {% extends "bootstrap/base.html" %} | ||||||
|  | {% import "bootstrap/utils.html" as utils %} | ||||||
| 
 | 
 | ||||||
| {% block title %}Prolefeeder{% endblock %} | {% block title %}Prolefeeder{% endblock %} | ||||||
| {% block content %} | {% block content %} | ||||||
| <div class="container"> | <div class="container"> | ||||||
| 
 | 
 | ||||||
| {% with messages = get_flashed_messages() %} | {{ utils.flashed_messages() }} | ||||||
| {% if messages %} |  | ||||||
|     {% for message in messages %} |  | ||||||
|     <div class="alert alert-info" role="alert">{{ message }}</div> |  | ||||||
|     {% endfor %} |  | ||||||
| {% endif %} |  | ||||||
| {% endwith %} |  | ||||||
| 
 | 
 | ||||||
| {% block app_content %} | {% block app_content %} | ||||||
| {% endblock %} | {% endblock %} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue