Skip to content

Commit

Permalink
Merge pull request #389 from newpanjing/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
newpanjing committed Jul 21, 2021
2 parents 545fb0c + 14f55c9 commit 14c3641
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion simpleui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def get_version():
return '2021.6.1'
return '2021.8.1'
8 changes: 6 additions & 2 deletions simpleui/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ def callback(self, request):
post = request.POST
action = post.get('_action')
selected = post.get('_selected')
select_across = post.get('select_across')

# call admin
if hasattr(self, action):
func, action, description = self.get_action(action)
# 这里的queryset 会有数据过滤,只包含选中的数据
queryset = self.get_queryset(request)
if selected and selected.split(','):
queryset = queryset.filter(pk__in=selected.split(','))

# 没有选择全部的时候才过滤数据
if select_across == '0':
if selected and selected.split(','):
queryset = queryset.filter(pk__in=selected.split(','))

return func(self, request, queryset)

Expand Down
4 changes: 2 additions & 2 deletions simpleui/templates/admin/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@
<span class="question">
<a href="#"
onclick="selectAll()"
title="{% trans "Click here to select the objects across all pages" %}">{% blocktrans with cl.result_count as total_count %}
Select all {{ total_count }} {{ module_name }}{% endblocktrans %}</a>
title="{% trans "Click here to select the objects across all pages" %}">{% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %}</a>
</span>
<span class="clear">
<a href="#" onclick="unSelect()">{% trans "Clear selection" %}</a>
Expand Down Expand Up @@ -230,6 +229,7 @@
let selecteds = [];
$("#result_list .selected input[name='_selected_action']").each((index, item) => selecteds.push(item.value));
data.append('_selected', selecteds.join(','));
data.append('select_across',document.querySelector("input[name='select_across']").value)
//获取选中的数据

data.append('csrfmiddlewaretoken', document.querySelector('[name="csrfmiddlewaretoken"]').value);
Expand Down
5 changes: 3 additions & 2 deletions simpleui/templates/admin/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
{% if password_reset_url %}

<div class="password-reset-link">
<a class="forgot-password" href="{{ password_reset_url }}">{% translate 'Forgotten your password or username?' %}</a>
<a class="forgot-password" href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
</div>
{% endif %}
<div class="simpleui-input-inline login-btn">
Expand All @@ -109,8 +109,9 @@
</div>
{% endblock %}
{% include 'admin/includes/js-part.html' %}

{% block login_js %}
<script type="text/javascript" src="{% static 'admin/simpleui-x/js/login.js' %}?_=3.3"></script>
{% endblock %}

{% block particles %}
{% if 'SIMPLEUI_LOGIN_PARTICLES'|get_config != False %}
Expand Down

0 comments on commit 14c3641

Please sign in to comment.