Browse Source

[Bugfix] 修复模板bug, 修复getattr bug

pull/446/head
ibuler 8 years ago
parent
commit
d2620a655c
  1. 1
      apps/assets/templates/assets/idc_assets.html
  2. 4
      apps/perms/models.py
  3. 7
      apps/users/templates/users/user_asset_permission.html

1
apps/assets/templates/assets/idc_assets.html

@ -112,7 +112,6 @@
</div>
</div>
</div>
{% include 'assets/_asset_bulk_update_modal.html' %}
{% endblock %}
{% block custom_foot_js %}
<script src="{% static 'js/jquery.form.min.js' %}"></script>

4
apps/perms/models.py

@ -57,7 +57,7 @@ class AssetPermission(models.Model):
for user in user_group.users.all():
setattr(user, 'is_inherit_from_user_groups', True)
setattr(user, 'inherit_from_user_groups',
getattr(user, b'inherit_from_user_groups', set()).add(user_group))
getattr(user, 'inherit_from_user_groups', set()).add(user_group))
users.add(user)
return users
@ -70,7 +70,7 @@ class AssetPermission(models.Model):
for asset in asset_group.assets.all():
setattr(asset, 'is_inherit_from_asset_groups', True)
setattr(asset, 'inherit_from_asset_groups',
getattr(asset, b'inherit_from_user_groups', set()).add(asset_group))
getattr(asset, 'inherit_from_user_groups', set()).add(asset_group))
assets.add(asset)
return assets

7
apps/users/templates/users/user_asset_permission.html

@ -77,22 +77,21 @@
{% csrf_token %}
<tr class="no-borders-tr">
<td colspan="1" style="padding-top: 0">
{% bootstrap_field form.name layout="horizontal" %}
</td>
</tr>
<tr class="no-borders-tr">
<td colspan="1" style="padding-top: 0">
{% bootstrap_field form.asset layout="horizontal" %}
{% bootstrap_field form.assets %}
</td>
</tr>
<tr class="no-borders-tr">
<td colspan="1" style="padding-top: 0">
{% bootstrap_field form.asset_groups layout="horizontal" %}
{% bootstrap_field form.asset_groups %}
</td>
</tr>
<tr class="no-borders-tr">
<td colspan="1" style="padding-top: 0">
{% bootstrap_field form.system_users layout="horizontal" %}
{% bootstrap_field form.system_users %}
</td>
</tr>
<tr class="no-borders-tr">

Loading…
Cancel
Save