adding lots in to modal addinglot form
This commit is contained in:
parent
f0dd2fb4ec
commit
a5a08a162c
|
@ -4,6 +4,7 @@ from flask.views import View
|
|||
from flask_login import login_required, current_user
|
||||
|
||||
from ereuse_devicehub.resources.device.models import Device
|
||||
from ereuse_devicehub.resources.lot.models import Lot
|
||||
|
||||
devices = Blueprint('inventory.devices', __name__, url_prefix='/inventory')
|
||||
|
||||
|
@ -19,7 +20,9 @@ class DeviceListView(View):
|
|||
Device.owner_id == current_user.id).filter(
|
||||
Device.type.in_(filter_types))
|
||||
|
||||
context = {'devices': devices}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
|
||||
context = {'devices': devices, 'lots': lots}
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,12 @@
|
|||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Please write a name of a lot
|
||||
Please write a name of a lot
|
||||
<select class="form-control selectpicker" id="selectLot" data-live-search="true">
|
||||
{% for lot in lots %}
|
||||
<option value="{{ lot.id }}">{{ lot.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
|
@ -15,3 +20,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#selectLot').selectpicker();
|
||||
});
|
||||
</script>
|
||||
|
|
Reference in New Issue