conditionally show columns
This commit is contained in:
parent
0dbb20fdab
commit
0d02b47df5
@ -13,6 +13,7 @@ PaaS - creates easily deployable declarative web applications with (moslty) file
|
||||
|
||||
|
||||
## TODO
|
||||
* [ ] [list] pagination of many items
|
||||
* [ ] [prod_install] Download sensitive prompt
|
||||
* [ ] [vm_gen] Auto generate dependency graph for `view_models/_process_order`
|
||||
* [ ] [auto_dns] Start and test `auto_dns.service`
|
||||
|
@ -325,7 +325,10 @@ def populate_static(app):
|
||||
if row_updates:
|
||||
row.update(row_updates)
|
||||
if model_name == "User":
|
||||
role_names = row.pop('role_names')
|
||||
if 'role_names' in row:
|
||||
role_names = row.pop('role_names')
|
||||
else:
|
||||
role_names = ""
|
||||
row['password'] = hash_password(row['password'])
|
||||
user = user_datastore.create_user(**row)
|
||||
for role_name in role_names.split(';'):
|
||||
@ -334,7 +337,7 @@ def populate_static(app):
|
||||
else:
|
||||
instance = create_model(model, row)
|
||||
db.session.add(instance)
|
||||
db.session.commit()
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def filter_m_n(serialized_args):
|
||||
|
@ -2,7 +2,8 @@
|
||||
<input type="hidden" name="_next" value="{{ _next or request.args.get('_next') or url_for('list_[[ name|camel_to_snake ]]') }}"/>
|
||||
<table>
|
||||
[%- for column in columns %]
|
||||
<tr><td>
|
||||
{% if "[[ column.name ]]" not in disabled_columns %}
|
||||
<tr {% if "[[ column.name ]]" in hidden_columns %}style="display: none;"{% endif %}><td>
|
||||
<label for="input-[[ name|camel_to_snake ]]-[[ column.name ]]">{{ _("[[ column.name ]]") }}</label>:
|
||||
</td><td>
|
||||
[%- if column.type in ['relationship'] %]
|
||||
@ -14,7 +15,7 @@
|
||||
[%- if not column.secondary %]
|
||||
<option selected="selected" value="">{{ _("Choose...") }}</option>
|
||||
[%- endif %]
|
||||
{% if instance and instance.[[ column.name|pluralize ]] is defined %}
|
||||
{% if [[ column.name|pluralize ]] is not defined and instance and instance.[[ column.name|pluralize ]] is defined %}
|
||||
{% set [[ column.name|pluralize ]] = instance.[[ column.name|pluralize ]] %}
|
||||
{% else %}
|
||||
{% set [[ column.name|pluralize ]] = model_views.[[ column.name ]].model.query.all() %}
|
||||
@ -49,6 +50,7 @@
|
||||
/>
|
||||
[%- endif %]
|
||||
</td></tr>
|
||||
{% endif %}
|
||||
[%- endfor %]
|
||||
</table>
|
||||
<input type="submit">
|
||||
|
@ -2,7 +2,8 @@
|
||||
<input type="hidden" name="_next" value="{{ _next or request.args.get('_next') or url_for('get_[[ name|camel_to_snake ]]', uuid=instance.id) }}"/>
|
||||
<table>
|
||||
[%- for column in columns %]
|
||||
<tr><td>
|
||||
{% if "[[ column.name ]]" not in disabled_columns %}
|
||||
<tr {% if "[[ column.name ]]" in hidden_columns %}style="display: none;"{% endif %}><td>
|
||||
<label for="input-[[ name|camel_to_snake ]]-[[ column.name ]]">{{ _("[[ column.name ]]") }}</label>:
|
||||
</td><td>
|
||||
[%- if column.type in ['relationship'] %]
|
||||
@ -49,6 +50,7 @@
|
||||
/>
|
||||
[%- endif %]
|
||||
</td></tr>
|
||||
{% endif %}
|
||||
[%- endfor %]
|
||||
</table>
|
||||
<input type="submit">
|
||||
|
Loading…
Reference in New Issue
Block a user