{% extends "base.html" %} 
{% block main_content %}
		<div class="container">
			<h3 class="offset-lg-2">{{page_title}}</h3>
			<div class="row">
				<form class="form form-inline col-xl-12" action="" method="POST" enctype="multipart/form-data">
					{{form.id}}
					{{form.csrf_token}}
					<div class="form-row col-lg-12">
						{{ form.fname.label( class="col-lg-2" ) }}
						{{ form.fname( id="fname", class="form-control col-lg-4" ) }}
						&nbsp;
						<label class="btn btn-outline-primary col-lg-2">
							Choose File
							<input name="refimg_file" type="file" onChange="DoMagic()" style="display:none;" id="new_file_chooser">
						</label>
					</div class="form-row col-lg-12">
					<div class="row col-lg-12">
					<br>
					</div class="row">
					<div class="form-row col-lg-12">
						{{ form.submit( class="btn btn-primary offset-lg-2 col-lg-2" )}}
						{% if 'Edit' in page_title %}
							{{ form.delete( class="btn btn-outline-danger col-lg-2" )}}
						{% endif %}
					</div class="form-row">
				</form>
			</div class="row">
		</div class="container">
{% endblock main_content %}

{% block script_content %}
<script>
	function DoMagic() {
		str=$("#new_file_chooser").val()
		console.log(str)
		str=str.replace('C:\\fakepath\\', '' )
		console.log(str)
		$("#fname").val(str)
	}
</script>
{% endblock script_content %}
