Was able to successfully implement htmx for interactive select. The advacement requires new documentation. sensor update have been implmented, sensor_add, sensor_account are the next steps
parent
a3858ff048
commit
996b2cdfcd
@ -1,79 +0,0 @@
|
||||
from flask import render_template, url_for, flash, redirect, request, Blueprint
|
||||
from flask_login import login_required, current_user
|
||||
from minibase.app import db
|
||||
import minibase.theme as theme
|
||||
from minibase.blueprints.company.models import Companies
|
||||
import minibase.blueprints.database.utils as dbUtils
|
||||
import minibase.blueprints.main.utils as mainUtils
|
||||
import minibase.blueprints.geography.utils as geoUtils
|
||||
import minibase.blueprints.company.utils as companyUtils
|
||||
from minibase.blueprints.company.forms import updateCompanyForm
|
||||
from minibase.blueprints.user.utils import save_picture
|
||||
from flask_wtf import FlaskForm
|
||||
|
||||
|
||||
# Declaring a blueprint
|
||||
company = Blueprint('company', __name__, template_folder='templates')
|
||||
|
||||
@company.route("/list", methods=['GET', 'POST'])
|
||||
def list():
|
||||
page=request.args.get('page', 1, type=int)
|
||||
table=dbUtils.table_printable_paginate(Companies, page, 20, 'edit/', 'id')
|
||||
return(render_template('view.html', theme=theme, table=table, title="Companies"))
|
||||
|
||||
|
||||
@company.route("/edit/<int:companyId>", methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def edit_company(companyId):
|
||||
if id:
|
||||
form = updateCompanyForm()
|
||||
company = companyUtils.queryById(companyId)
|
||||
form.city.choices = [(row.id, row.name) for row in geoUtils.queryCiytNamesOfStateWithDefId(company.city_id, company.state_id)]
|
||||
form.state.choices = [(row.id, row.name) for row in geoUtils.queryStateNamesOfCuntryWithDefId(company.state_id, company.country_id)]
|
||||
form.country.choices = [(row.id, row.name) for row in geoUtils.queryCountryNamesWithDefault(company.country_id)]
|
||||
form.industry.choices = [(row.id, row.name) for row in mainUtils.queryIndustryNamesWithDefault(company.industry_id)]
|
||||
form.legal_entity.choices = [(row.id, row.name) for row in companyUtils.queryLegalEntityNames()]
|
||||
form.type.choices = [(row.id, row.name) for row in companyUtils.queryTypeNames()]
|
||||
form.relation.choices = [(row.id, row.name) for row in companyUtils.queryRelationNames()]
|
||||
form.status.choices = [(row.id, row.name) for row in companyUtils.queryStatusNames()]
|
||||
|
||||
if form.validate_on_submit():
|
||||
comp = Companies(
|
||||
name = form.name.data,
|
||||
street = form.street.data,
|
||||
website = form.website.data,
|
||||
street_no = form.street_no.data,
|
||||
post_code = form.post_code.data,
|
||||
city_id = form.city.data,
|
||||
state_id = form.state.data,
|
||||
country_id = form.country.data,
|
||||
industry_id = form.industry.data,
|
||||
legal_entity_id = form.legal_entity.data,
|
||||
type_id = form.type.data,
|
||||
relation_id = form.relation.data,
|
||||
status_id = form.status.data,
|
||||
comment = form.comment.data)
|
||||
flash('Company Has been successfully updated', 'success')
|
||||
return redirect(url_for('company.edit', companyId))
|
||||
elif request.method == 'GET':
|
||||
form.name.data = company.name
|
||||
form.website.data = company.website
|
||||
form.street.data = company.street
|
||||
form.street_no.data = company.street_no
|
||||
form.post_code.data = company.post_code
|
||||
|
||||
form.comment.data = company.comment
|
||||
# This could be very interesting but neds more time to think !
|
||||
#for field in form:
|
||||
# if field.name != 'csrf_token' and hasattr(company, field.name):
|
||||
# attr = getattr(company, field.name)
|
||||
# field.data = attr
|
||||
image_file = url_for('static', filename='pics/' + companyUtils.queryImageById(companyId))
|
||||
|
||||
return render_template('company/account.html',
|
||||
theme=theme,
|
||||
image_file=image_file,
|
||||
form=form)
|
||||
else:
|
||||
flash('You need to select a company id', 'alarm')
|
||||
return redirect(url_for('company.list'))
|
@ -0,0 +1,139 @@
|
||||
from flask import render_template, Blueprint, request, flash, redirect, url_for
|
||||
import minibase.theme as theme
|
||||
from minibase.blueprints.sensor.models import nbiotDevice
|
||||
import minibase.blueprints.sensor.utils as sensorUtils
|
||||
from minibase.blueprints.sensor.forms import updateNbioDeviceUpdateForm, updateNbioDeviceAddForm
|
||||
import minibase.blueprints.database.utils as dbUtils
|
||||
import minibase.blueprints.company.utils as companyUtils
|
||||
import minibase.blueprints.user.utils as userUtils
|
||||
from minibase.app import db
|
||||
import json
|
||||
import os
|
||||
|
||||
sensor = Blueprint('sensor', __name__, template_folder='templates')
|
||||
|
||||
DATA_FILE = 'data.json'
|
||||
|
||||
sensor.route('/callback', methods=['POST'])
|
||||
def callback():
|
||||
data = request.json
|
||||
|
||||
if not data:
|
||||
return jsonify({"error": "Invalid data"}), 400
|
||||
|
||||
# Read existing data
|
||||
if os.path.exists(DATA_FILE):
|
||||
with open(DATA_FILE, 'r') as f:
|
||||
stored_data = json.load(f)
|
||||
else:
|
||||
stored_data = []
|
||||
|
||||
# Append new data
|
||||
stored_data.append(data)
|
||||
|
||||
# Write data back to file
|
||||
with open(DATA_FILE, 'w') as f:
|
||||
json.dump(stored_data, f, indent=4)
|
||||
|
||||
return 'Callback received', 200
|
||||
|
||||
|
||||
@sensor.route('/data', methods=['GET'])
|
||||
def get_data():
|
||||
if os.path.exists(DATA_FILE):
|
||||
with open(DATA_FILE, 'r') as f:
|
||||
stored_data = json.load(f)
|
||||
else:
|
||||
stored_data = []
|
||||
|
||||
return jsonify(stored_data)
|
||||
|
||||
|
||||
@sensor.route('/list', methods=['GET','POST'])
|
||||
def list():
|
||||
page=request.args.get('page', 1, type=int)
|
||||
table=dbUtils.table_printable_paginate(nbiotDevice, page, 20, 'edit/', 'id')
|
||||
return(render_template('view.html', theme=theme, table=table, title="Devices List"))
|
||||
|
||||
|
||||
@sensor.route("/edit/<int:deviceId>", methods=['GET', 'POST'])
|
||||
def edit(deviceId):
|
||||
if deviceId:
|
||||
device = nbiotDevice.query.get_or_404(deviceId)
|
||||
form = updateNbioDeviceUpdateForm(current_device_id=device.id)
|
||||
form.user_id.choices = [(row.id, row.username) for row in userUtils.queryUserNamesWithDefault(device.user_id)]
|
||||
form.owner_id.choices = [(row.id, row.username) for row in userUtils.queryUserNamesWithDefault(device.user_id)]
|
||||
form.manufacturer_id.choices = [(row.id, row.name) for row in companyUtils.queryNamesWithDefault(device.manufacturer_id)]
|
||||
form.company_id.choices = [(row.id, row.name) for row in companyUtils.queryNamesWithDefault(device.company_id)]
|
||||
form.status_id.choices = [(row.id, row.name) for row in sensorUtils.queryStatusNamesWithDefault(device.status_id)]
|
||||
form.type_id.choices = [(row.id, row.name) for row in sensorUtils.queryTypeNamesWithDefault(device.type_id)]
|
||||
form.area_id.choices = [(row.id, row.name) for row in sensorUtils.queryAreaNamesWithDefault(device.area_id)]
|
||||
if form.validate_on_submit():
|
||||
device.name=form.name.data
|
||||
device.serial_no = form.serial_no.data
|
||||
device.device_id=form.device_id.data
|
||||
device.imsi=form.imsi.data
|
||||
device.iccid=form.iccid.data
|
||||
device.ip=form.ip.data
|
||||
device.port=form.port.data
|
||||
device.registration_date=form.registration_date.data
|
||||
device.activation_date=form.activation_date.data
|
||||
device.deactivation_date=form.deactivation_date.data
|
||||
device.owner_id=form.owner_id.data
|
||||
device.user_id=form.user_id.data
|
||||
device.status_id=form.status_id.data
|
||||
device.type_id=form.type_id.data
|
||||
device.area_id=form.area_id.data
|
||||
device.manufacturer_id = form.manufacturer_id.data
|
||||
device.company_id = form.manufacturer_id.data
|
||||
db.session.commit()
|
||||
flash('Device has been successfully updated', 'success')
|
||||
return redirect(url_for('sensor.edit', deviceId=deviceId))
|
||||
elif request.method == 'GET':
|
||||
form.name.data = device.name
|
||||
form.serial_no.data = device.serial_no
|
||||
form.device_id.data = device.device_id
|
||||
form.imsi.data = device.imsi
|
||||
form.iccid.data = device.iccid
|
||||
form.ip.data = device.ip
|
||||
form.port.data = device.port
|
||||
form.registration_date.data = device.registration_date
|
||||
form.activation_date.data = device.activation_date
|
||||
form.deactivation_date.data = device.deactivation_date
|
||||
|
||||
return render_template('sensor/account.html',
|
||||
theme=theme,
|
||||
form=form)
|
||||
else:
|
||||
flash('You need to select a Device id', 'alarm')
|
||||
return redirect(url_for('sensor.list'))
|
||||
|
||||
|
||||
@sensor.route('/add', methods=['GET', 'POST'])
|
||||
def add():
|
||||
form = updateNbioDeviceAddForm()
|
||||
form.user_id.choices = [(row.id, row.username) for row in userUtils.queryUserChoices(1)]
|
||||
form.status_id.choices = [(row.id, row.name) for row in sensorUtils.queryStatusChoices(1)]
|
||||
form.type_id.choices = [(row.id, row.name) for row in sensorUtils.queryTypeChoices(1)]
|
||||
form.area_id.choices = [(row.id, row.name) for row in sensorUtils.queryAreaChoices(1)]
|
||||
if form.validate_on_submit():
|
||||
dev = nbiotDevice(
|
||||
name=form.name.data,
|
||||
device_id=form.device_id.data,
|
||||
imsi=form.imsi.data,
|
||||
iccid=form.iccid.data,
|
||||
ip=form.ip.data,
|
||||
port=form.port.data,
|
||||
registration_date=form.registration_date.data,
|
||||
activation_date=form.activation_date.data,
|
||||
deactivation_date=form.deactivation_date.data,
|
||||
user_id=form.user_id.data,
|
||||
status_id=form.status_id.data,
|
||||
type_id=form.type_id.data,
|
||||
area_id=form.area_id.data)
|
||||
dbUtils.dbAddAndCommit(dev)
|
||||
flash('Device has been successfully added', 'success')
|
||||
|
||||
return render_template('sensor/account.html',
|
||||
theme=theme,
|
||||
form=form)
|
@ -0,0 +1 @@
|
||||
,key,devbian,13.08.2024 18:20,file:///home/key/.config/libreoffice/4;
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,7 @@
|
||||
{% for city in cities %}
|
||||
<option value="{{ city.id }}">{{ city.name }}</option>
|
||||
{% endfor %}
|
||||
|
||||
{% for state in states %}
|
||||
<option value="{{ state.id }}">{{ state.name }}</option>
|
||||
{% endfor %}
|
@ -0,0 +1,3 @@
|
||||
{% for state in states %}
|
||||
<option value="{{ state.id }}">{{ state.name }}</option>
|
||||
{% endfor %}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,37 +1,16 @@
|
||||
import os
|
||||
import secrets
|
||||
from PIL import Image
|
||||
from flask import url_for, current_app
|
||||
from flask_mail import Message
|
||||
from minibase.app import mail
|
||||
from minibase.blueprints.user.models import Users, User_Roles
|
||||
import minibase.blueprints.database.utils as dbUtils
|
||||
from sqlalchemy import case
|
||||
|
||||
|
||||
def dbGetMailFirst(mail):
|
||||
return Users.query.filter_by(email_account=mail).first()
|
||||
|
||||
def save_picture(form_picture):
|
||||
random_hex = secrets.token_hex(8)
|
||||
_, f_ext = os.path.splitext(form_picture.filename)
|
||||
picture_fn = random_hex + f_ext
|
||||
picture_path = os.path.join(current_app.root_path, 'static/pics', picture_fn)
|
||||
output_size = (125, 125)
|
||||
i = Image.open(form_picture)
|
||||
i.thumbnail(output_size)
|
||||
i.save(picture_path)
|
||||
return picture_fn
|
||||
|
||||
|
||||
def send_reset_email(user):
|
||||
token = user.get_reset_token()
|
||||
msg = Message('Password Reset Request',
|
||||
sender='noreply@demo.com',
|
||||
recipients=[user.email_account])
|
||||
msg.body = f'''To reset your password, visit the following link:
|
||||
{url_for('user.reset_token', token=token, _external=True)}
|
||||
If you didn't make this request, then simply ingnore this email and no chancges will be made.
|
||||
'''
|
||||
mail.send(msg)
|
||||
|
||||
|
||||
def queryRoleById(id):
|
||||
return User_Roles.query.get_or_404(id)
|
||||
|
||||
|
||||
def queryUserNamesWithDefault(defId):
|
||||
choices = Users.query.order_by(case((Users.id == defId, 0),else_=1),Users.username.asc())
|
||||
return choices;
|
||||
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
@ -0,0 +1,7 @@
|
||||
{% include 'form/stringField.html' %}
|
||||
{% include 'form/selectField.html' %}
|
||||
{% include 'form/dateField.html' %}
|
||||
{% include 'form/boolField.html' %}
|
||||
{% include 'form/fileField.html' %}
|
||||
{% include 'form/urlField.html' %}
|
||||
{% include 'form/integerField.html' %}
|
@ -1,15 +1,6 @@
|
||||
{% if item.type == 'BooleanField' %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.check_label_class, style=theme.form.check_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type == 'BooleanField' %}
|
||||
<br>
|
||||
{{ item(class=theme.form.check_class) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -1,23 +0,0 @@
|
||||
{% for item in form %}
|
||||
{% if item.id == 'submit' %}
|
||||
{% elif item.id == 'csrf_token' %}
|
||||
{% else %}
|
||||
{% if item.type == 'BooleanField' %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.check_label_class, style=theme.form.check_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type == 'BooleanField' %}
|
||||
<br>
|
||||
{{ item(class=theme.form.check_class) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -1,15 +1,6 @@
|
||||
{% if item.type in ['DateField', 'DateTimeField'] %}
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['DateField', 'DateTimeField'] %}
|
||||
{{ item(class=theme.form.input_class, type=theme.form.date_type) }}
|
||||
{% endif %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.date_label_class, style=theme.form.date_label_style) }}
|
||||
<br>
|
||||
{{ item(class=theme.form.date_class, style=theme.form.date_style, type=theme.form.date_type) }}
|
||||
{% endif %}
|
||||
|
@ -1,23 +0,0 @@
|
||||
{% for item in form %}
|
||||
{% if item.id == 'submit' %}
|
||||
{% elif item.id == 'csrf_token' %}
|
||||
{% else %}
|
||||
{% if item.type in ['DateField', 'DateTimeField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['DateField', 'DateTimeField'] %}
|
||||
<br>
|
||||
{{ item(class=theme.form.input_class, type=theme.form.date_type) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -1,17 +1,6 @@
|
||||
{% if item.type in ['FileField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.file_label_class, style=theme.form.file_label_style) }}
|
||||
<br>
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['FileField'] %}
|
||||
{{ item(class=theme.form.file_class, type=theme.form.file_type, style=theme.form.file_style) }}
|
||||
<br>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -1,15 +1,6 @@
|
||||
{% if item.type in ['IntegerField', 'DecimalField', 'FloatField'] %}
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['IntegerField', 'DecimalField', 'FloatField'] %}
|
||||
{{ item(class=theme.form.input_class) }}
|
||||
{% endif %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.integer_label_class, style=theme.form.integer_label_style) }}
|
||||
<br>
|
||||
{{ item(class=theme.form.integer_class, style=theme.form.integer_style) }}
|
||||
{% endif %}
|
||||
|
@ -0,0 +1,6 @@
|
||||
{% if item.type in ['SelectField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.select_label_class, style=theme.form.select_label_style) }}
|
||||
<br>
|
||||
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style)}}
|
||||
{% endif %}
|
@ -1,17 +0,0 @@
|
||||
{% if item.type in ['SelectField'] %}
|
||||
{{ item.label(class=theme.form.select_label_class, style=theme.form.select_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="col">
|
||||
{% if item.type in ['SelectField'] %}
|
||||
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
@ -1,17 +0,0 @@
|
||||
{% if item.type in ['SelectField'] %}
|
||||
{{ item.label(class=theme.form.select_label_class, style=theme.form.select_label_style) }}
|
||||
<br>
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.select_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['SelectField'] %}
|
||||
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style) }}
|
||||
<br>
|
||||
{% endif %}
|
||||
{% endif %}
|
@ -1,23 +0,0 @@
|
||||
{% for item in form %}
|
||||
{% if item.id == 'submit' %}
|
||||
{% elif item.id == 'csrf_token' %}
|
||||
{% else %}
|
||||
{% if item.type in ['SelectField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['SelectField'] %}
|
||||
<br>
|
||||
{{ item(class=theme.form.select_class, type=theme.form.select_type, style=theme.form.select_style) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -1,17 +1,6 @@
|
||||
{% if item.type in ['StringField', 'TextAreaField', 'PasswordField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['StringField', 'TextAreaField', 'PasswordField'] %}
|
||||
<div class="col">
|
||||
{{ item(class=theme.form.input_class) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<br>
|
||||
{{ item(class=theme.form.input_class, style=theme.form.input_style) }}
|
||||
{% endif %}
|
||||
|
@ -1,21 +0,0 @@
|
||||
{% for item in form %}
|
||||
{% if item.id == 'submit' %}
|
||||
{% elif item.id == 'csrf_token' %}
|
||||
{% else %}
|
||||
{% if item.type in ['StringField', 'TextAreaField', 'PasswordField'] %}
|
||||
{{ item.label(class=theme.form.input_label_class, style=theme.form.input_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.input_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['StringField', 'TextAreaField', 'PasswordField'] %}
|
||||
{{ item(class=theme.form.input_class) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -1,15 +1,6 @@
|
||||
{% if item.type in ['URLField'] %}
|
||||
<br>
|
||||
{{ item.label(class=theme.form.url_label_class, style=theme.form.url_label_style) }}
|
||||
{% endif %}
|
||||
{% if item.errors %}
|
||||
{{ item(class=theme.form.url_error_class) }}
|
||||
<div class="{{ theme.form.div_error_class }}">
|
||||
{% for error in item.errors %}
|
||||
<span>{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% else %}
|
||||
{% if item.type in ['URLField'] %}
|
||||
<br>
|
||||
{{ item(class=theme.form.url_class, type=theme.form.url_type, style=theme.form.url_style) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
@ -1,34 +0,0 @@
|
||||
<form method="POST" action="" enctype="multipart/form-data">
|
||||
{{ form.hidden_tag() }}
|
||||
<fieldset class="form-group">
|
||||
{% if itemList | length == 1 %}
|
||||
<div class="col-md-3 rounded">
|
||||
<div class="p-3 py-5">
|
||||
{% include 'form.html' %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
{% for labelItems in itemList %}
|
||||
<div class="col-md-3">
|
||||
<div class="p-3 py-4">
|
||||
{% for item in form %}
|
||||
{% if item.id == 'submit' %}
|
||||
{% elif item.id == 'csrf_token' %}
|
||||
{% else %}
|
||||
{% for label in labelItems %}
|
||||
{% if label == item.name %}
|
||||
{% include 'form/stringField.html' %}
|
||||
{% include 'form/selectFieldVer.html' %}
|
||||
{% include 'form/dateField.html' %}
|
||||
{% include 'form/boolField.html' %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</fieldset>
|
||||
<div>{% include 'form/submitField.html' %}</div>
|
||||
</form>
|
@ -1,10 +0,0 @@
|
||||
<form method="POST" action="" enctype="multipart/form-data">
|
||||
{{ form.hidden_tag() }}
|
||||
<fieldset class="form-group">
|
||||
<div>{% include 'form/stringFields.html' %}</div>
|
||||
<div>{% include 'form/selectFields.html' %}</div>
|
||||
<div>{% include 'form/dateFields.html' %}</div>
|
||||
<div>{% include 'form/boolFields.html' %}</div>
|
||||
</fieldset>
|
||||
<div>{% include 'form/submitField.html' %}</div>
|
||||
</form>
|
Loading…
Reference in new issue