Commit 0848893f authored by ibuler's avatar ibuler

[Bugfix] 修复时间日期搜索的bug,select2模块自适应长度

parent 3d705dbe
......@@ -90,7 +90,7 @@
}
}
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
authFieldsDisplay();
$(auto_generate_key).change(function () {
authFieldsDisplay();
......
......@@ -56,7 +56,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
})
</script>
{% endblock %}
\ No newline at end of file
......@@ -157,7 +157,7 @@ function bindToCluster(clusters) {
jumpserver.cluster_selected = {};
$(document).ready(function () {
$('.select2').select2().on('select2:select', function(evt) {
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.cluster_selected[data.id] = data.text;
}).on('select2:unselect', function(evt) {
......
......@@ -30,7 +30,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
}).on('click', '.field-tag', function() {
changeField(this);
}).on('click', '#change_all', function () {
......
......@@ -47,7 +47,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
{# $("#id_tags").select2({#}
{# tags: true,#}
{# maximumSelectionLength: 8 //最多能够选择的个数#}
......
......@@ -81,7 +81,7 @@
{% block custom_foot_js %}
<script type="text/javascript">
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
$('.select2-system-user').select2();
});
......
......@@ -184,7 +184,7 @@ function initTable() {
}
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
$('.select2.asset-select').select2()
.on('select2:select', function(evt) {
......
......@@ -181,7 +181,7 @@ function initTable() {
}
$(document).ready(function () {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on("select2:select", function (evt) {
var data = evt.params.data;
jumpserver.assets_selected[data.id] = data.text;
......
......@@ -69,7 +69,10 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({
dropdownAutoWidth : true,
width: 'auto'
});
})
</script>
{% endblock %}
\ No newline at end of file
......@@ -151,7 +151,7 @@
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
})
.on('click', '.btn-delete-cluster', function () {
var name = "{{ cluster.name }}";
......
......@@ -125,7 +125,7 @@ function initAssetsTable() {
}
$(document).ready(function () {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on("select2:select", function (evt) {
var data = evt.params.data;
jumpserver.assets_selected[data.id] = data.text;
......
......@@ -212,7 +212,7 @@ function updateSystemUserCluster(clusters) {
}
jumpserver.cluster_selected = {};
$(document).ready(function () {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.cluster_selected[data.id] = data.text;
......
......@@ -18,7 +18,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
})
</script>
{% endblock %}
\ No newline at end of file
......@@ -3,14 +3,14 @@
import inspect
from django.db import models
from django.http import JsonResponse
from django.utils.timezone import now
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
class NoDeleteQuerySet(models.query.QuerySet):
def delete(self):
return self.update(is_discard=True, discard_time=now())
return self.update(is_discard=True, discard_time=timezone.now())
class NoDeleteManager(models.Manager):
......@@ -36,7 +36,7 @@ class NoDeleteModelMixin(models.Model):
def delete(self):
self.is_discard = True
self.discard_time = now()
self.discard_time = timezone.now()
return self.save()
......@@ -87,3 +87,29 @@ class BulkSerializerMixin(object):
return ret
class DatetimeSearchMixin:
date_from = date_to = None
def get(self, request, *args, **kwargs):
date_from_s = self.request.GET.get('date_from')
date_to_s = self.request.GET.get('date_to')
if date_from_s:
date_from = timezone.datetime.strptime(date_from_s, '%m/%d/%Y')
self.date_from = date_from.replace(
tzinfo=timezone.get_current_timezone()
)
else:
self.date_from = timezone.now() - timezone.timedelta(7)
if date_to_s:
date_to = timezone.datetime.strptime(
date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S'
)
self.date_to = date_to.replace(
tzinfo=timezone.get_current_timezone()
)
else:
self.date_to = timezone.now()
return super().get(request, *args, **kwargs)
\ No newline at end of file
......@@ -16,9 +16,9 @@
<div class="form-group" id="date">
<div class="input-daterange input-group" id="datepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from|date:"m/d/Y" }}">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to|date:"m/d/Y" }}">
</div>
</div>
<div class="input-group">
......@@ -89,7 +89,10 @@ $(document).ready(function() {
"bInfo" : false,
"order": []
});
$('.select2').select2();
$('.select2').select2({
dropdownAutoWidth : true,
width: 'auto'
});
$('#date .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
keyboardNavigation: false,
......
......@@ -9,40 +9,27 @@ from django.views.generic import ListView, DetailView, View
from django.utils import timezone
from django.shortcuts import redirect, reverse
from common.mixins import DatetimeSearchMixin
from .models import Task, AdHoc, AdHocRunHistory
from ops.tasks import rerun_task
class TaskListView(ListView):
class TaskListView(DatetimeSearchMixin, ListView):
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
model = Task
ordering = ('-date_created',)
context_object_name = 'task_list'
template_name = 'ops/task_list.html'
date_format = '%m/%d/%Y'
keyword = date_from_s = date_to_s = ''
keyword = ''
def get_queryset(self):
date_to_default = timezone.now()
date_from_default = timezone.now() - timezone.timedelta(7)
date_from_default_s = date_from_default.strftime(self.date_format)
date_to_default_s = date_to_default.strftime(self.date_format)
self.queryset = super().get_queryset()
self.keyword = self.request.GET.get('keyword', '')
self.date_from_s = self.request.GET.get('date_from', date_from_default_s)
self.date_to_s = self.request.GET.get('date_to', date_to_default_s)
if self.date_from_s:
date_from = datetime.strptime(self.date_from_s, self.date_format)
date_from = date_from.replace(tzinfo=timezone.get_current_timezone())
self.queryset = self.queryset.filter(date_created__gt=date_from)
if self.date_to_s:
date_to = timezone.datetime.strptime(
self.date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S')
date_to = date_to.replace(tzinfo=timezone.get_current_timezone())
self.queryset = self.queryset.filter(date_created__lt=date_to)
self.queryset = self.queryset.filter(
date_created__gt=self.date_from,
date_created__lt=self.date_to
)
if self.keyword:
self.queryset = self.queryset.filter(
......@@ -51,15 +38,16 @@ class TaskListView(ListView):
return self.queryset
def get_context_data(self, **kwargs):
print(self.date_from)
context = {
'app': 'Ops',
'action': _('Task list'),
'date_from': self.date_from_s,
'date_to': self.date_to_s,
'date_from': self.date_from,
'date_to': self.date_to,
'keyword': self.keyword,
}
kwargs.update(context)
return super(TaskListView, self).get_context_data(**kwargs)
return super().get_context_data(**kwargs)
class TaskDetailView(DetailView):
......
......@@ -79,7 +79,7 @@
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
$('.input-group.date').datepicker({
format: "yyyy-mm-dd",
......
......@@ -190,7 +190,7 @@ function updateSystemUser(system_users) {
}
$(document).ready(function () {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.system_users_selected[data.id] = data.text;
......
......@@ -5,6 +5,8 @@
{% block custom_head_css_js %}
<link href="{% static "css/plugins/footable/footable.core.css" %}" rel="stylesheet">
<link href="{% static 'css/plugins/datepicker/datepicker3.css' %}" rel="stylesheet">
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
<style>
#search_btn {
margin-bottom: 0;
......@@ -20,9 +22,9 @@
<div class="form-group" id="date">
<div class="input-daterange input-group" id="datepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from|date:"m/d/Y" }}">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to|date:"m/d/Y" }}">
</div>
</div>
<div class="input-group">
......@@ -93,20 +95,23 @@
{% endblock %}
{% block custom_foot_js %}
<script src="{% static "js/plugins/footable/footable.all.min.js" %}"></script>
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
$(document).ready(function () {
$('.footable').footable();
$('.select2').select2();
$('#date .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
<script src="{% static "js/plugins/footable/footable.all.min.js" %}"></script>
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
$(document).ready(function () {
$('.footable').footable();
$('.select2').select2({
dropdownAutoWidth : true,
width: 'auto'
});
</script>
$('#date .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
});
</script>
{% endblock %}
......@@ -4,6 +4,8 @@
{% load terminal_tags %}
{% block custom_head_css_js %}
<link href="{% static 'css/plugins/datepicker/datepicker3.css' %}" rel="stylesheet">
<link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
<script src="{% static "js/plugins/select2/select2.full.min.js" %}"></script>
<style>
#search_btn {
margin-bottom: 0;
......@@ -20,9 +22,9 @@
<div class="form-group" id="date">
<div class="input-daterange input-group" id="datepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from|date:"m/d/Y" }}">
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to|date:"m/d/Y" }}">
</div>
</div>
<div class="input-group">
......@@ -129,7 +131,8 @@
"order": []
});
$('.select2').select2({
dropdownAutoWidth: true
dropdownAutoWidth: true,
width: "auto"
});
$('#date .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
......
......@@ -57,7 +57,7 @@
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
$('.input-group.date').datepicker({
format: "yyyy-mm-dd",
......
# -*- coding: utf-8 -*-
#
from datetime import datetime
from django.views.generic import ListView
from django.conf import settings
from django.utils import timezone
from django.utils.translation import ugettext as _
from common.mixins import DatetimeSearchMixin
from ..models import Command
from .. import utils
from ..backends import get_command_store
......@@ -15,39 +15,19 @@ __all__ = ['CommandListView']
command_store = get_command_store()
class CommandListView(ListView):
class CommandListView(DatetimeSearchMixin, ListView):
model = Command
template_name = "terminal/command_list.html"
context_object_name = 'command_list'
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
command = user = asset = system_user = date_from_s = date_to_s = ''
command = user = asset = system_user = ""
date_from = date_to = None
date_format = '%m/%d/%Y'
def get_queryset(self):
date_to_default = timezone.now()
date_from_default = timezone.now() - timezone.timedelta(7)
date_to_default_s = date_to_default.strftime(self.date_format)
date_from_default_s = date_from_default.strftime(self.date_format)
self.command = self.request.GET.get('command', '')
self.user = self.request.GET.get('user')
self.asset = self.request.GET.get('asset')
self.system_user = self.request.GET.get('system_user')
self.date_from_s = self.request.GET.get('date_from', date_from_default_s)
self.date_to_s = self.request.GET.get('date_to', date_to_default_s)
filter_kwargs = {}
if self.date_from_s:
date_from = datetime.strptime(self.date_from_s, self.date_format)
date_from = date_from.replace(
tzinfo=timezone.get_current_timezone()
)
filter_kwargs['date_from'] = date_from
if self.date_to_s:
date_to = timezone.datetime.strptime(
self.date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S')
date_to = date_to.replace(tzinfo=timezone.get_current_timezone())
filter_kwargs['date_to'] = date_to
filter_kwargs = dict()
filter_kwargs['date_from'] = self.date_from
filter_kwargs['date_to'] = self.date_to
if self.user:
filter_kwargs['user'] = self.user
if self.asset:
......@@ -68,8 +48,8 @@ class CommandListView(ListView):
'asset_list': utils.get_asset_list_from_cache(),
'system_user_list': utils.get_system_user_list_from_cache(),
'command': self.command,
'date_from': self.date_from_s,
'date_to': self.date_to_s,
'date_from': self.date_from,
'date_to': self.date_to,
'username': self.user,
'asset': self.asset,
'system_user': self.system_user,
......
# -*- coding: utf-8 -*-
#
import time
from datetime import datetime
from django.views.generic import ListView, UpdateView, DeleteView, DetailView, TemplateView
from django.views.generic.edit import SingleObjectMixin
from django.utils.translation import ugettext as _
from django.utils import timezone
from django.utils.module_loading import import_string
from django.urls import reverse_lazy
from django.http import HttpResponse
from django.conf import settings
from django.db.models import Q
from users.utils import AdminUserRequiredMixin
from common.mixins import DatetimeSearchMixin
from ..models import Session, Command, Terminal
from ..backends import get_command_store
from .. import utils
......@@ -28,37 +22,24 @@ __all__ = [
command_store = get_command_store()
class SessionListView(AdminUserRequiredMixin, ListView):
class SessionListView(AdminUserRequiredMixin, DatetimeSearchMixin, ListView):
model = Session
template_name = 'terminal/session_list.html'
context_object_name = 'session_list'
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
user = asset = system_user = date_from_s = date_to_s = ''
user = asset = system_user = ''
date_from = date_to = None
date_format = '%m/%d/%Y'
def get_queryset(self):
date_to_default = timezone.now()
date_from_default = timezone.now() - timezone.timedelta(7)
date_to_default_s = date_to_default.strftime(self.date_format)
date_from_default_s = date_from_default.strftime(self.date_format)
self.queryset = super().get_queryset()
self.user = self.request.GET.get('user')
self.asset = self.request.GET.get('asset')
self.system_user = self.request.GET.get('system_user')
self.date_from_s = self.request.GET.get('date_from', date_from_default_s)
self.date_to_s = self.request.GET.get('date_to', date_to_default_s)
filter_kwargs = {}
if self.date_from_s:
date_from = datetime.strptime(self.date_from_s, self.date_format)
date_from = date_from.replace(tzinfo=timezone.get_current_timezone())
filter_kwargs['date_start__gt'] = date_from
if self.date_to_s:
date_to = timezone.datetime.strptime(
self.date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S')
date_to = date_to.replace(tzinfo=timezone.get_current_timezone())
filter_kwargs['date_start__lt'] = date_to
filter_kwargs = dict()
filter_kwargs['date_start__gt'] = self.date_from
filter_kwargs['date_start__lt'] = self.date_to
if self.user:
filter_kwargs['user'] = self.user
if self.asset:
......@@ -76,8 +57,8 @@ class SessionListView(AdminUserRequiredMixin, ListView):
'user_list': utils.get_user_list_from_cache(),
'asset_list': utils.get_asset_list_from_cache(),
'system_user_list': utils.get_system_user_list_from_cache(),
'date_from': self.date_from_s,
'date_to': self.date_to_s,
'date_from': self.date_from,
'date_to': self.date_to,
'username': self.user,
'asset': self.asset,
'system_user': self.system_user,
......
......@@ -56,7 +56,7 @@
<script src="{% static 'js/plugins/datepicker/bootstrap-datepicker.js' %}"></script>
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
$('.input-group.date').datepicker({
format: "yyyy-mm-dd",
......
......@@ -17,9 +17,10 @@
<div class="form-group" id="date">
<div class="input-daterange input-group" id="datepicker">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" value="{{ date_from|date:"m/d/Y"}}">
{# <input type="text" class="input-sm form-control" style="width: 100px;" name="date_from" >#}
<span class="input-group-addon">to</span>
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to }}">
<input type="text" class="input-sm form-control" style="width: 100px;" name="date_to" value="{{ date_to|date:"m/d/Y"}}">
</div>
</div>
<div class="input-group">
......@@ -80,10 +81,11 @@
"order": []
});
$('#date .input-daterange').datepicker({
dateFormat: 'mm/dd/yy',
dateFormat: "mm/dd/yyy",
keyboardNavigation: false,
forceParse: false,
autoclose: true
});
$('.select2').select2({
dropdownAutoWidth: true
......
......@@ -30,7 +30,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
}).on('click', '.field-tag', function() {
changeField(this);
}).on('click', '#change_all', function () {
......
......@@ -253,7 +253,7 @@ function updateUserGroups(groups) {
}
$(document).ready(function() {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.groups_selected[data.id] = data.text;
......
......@@ -98,7 +98,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
var options = {
ele: $('#user_assets_table'),
buttons: [],
......
......@@ -57,7 +57,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
})
</script>
{% endblock %}
......@@ -150,7 +150,7 @@ function updateGroupMember(users) {
}
$(document).ready(function () {
$('.select2').select2()
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.users_selected[data.id] = data.text;
......
......@@ -102,7 +102,7 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
$('.select2').select2({ dropdownAutoWidth : true, width: 'auto' });
var options = {
ele: $('#user_assets_table'),
buttons: [],
......
......@@ -22,6 +22,7 @@ from django.conf import settings
from django.utils import timezone
from common.utils import get_object_or_none
from common.mixins import DatetimeSearchMixin
from ..models import User, LoginLog
from ..utils import send_reset_password_mail
from ..tasks import write_login_log_async
......@@ -210,55 +211,38 @@ class UserFirstLoginView(LoginRequiredMixin, SessionWizardView):
return form
class LoginLogListView(ListView):
class LoginLogListView(DatetimeSearchMixin, ListView):
template_name = 'users/login_log_list.html'
model = LoginLog
paginate_by = settings.CONFIG.DISPLAY_PER_PAGE
username = keyword = date_from_s = date_to_s = ""
username = keyword = ""
date_to = date_from = None
date_format = '%m/%d/%Y'
def get_queryset(self):
date_to_default = timezone.now()
date_from_default = timezone.now() - timezone.timedelta(7)
date_to_default_s = date_to_default.strftime(self.date_format)
date_from_default_s = date_from_default.strftime(self.date_format)
self.username = self.request.GET.get('username', '')
self.keyword = self.request.GET.get("keyword", '')
self.date_from_s = self.request.GET.get('date_from', date_from_default_s)
self.date_to_s = self.request.GET.get('date_to', date_to_default_s)
self.queryset = super().get_queryset()
queryset = super().get_queryset()
queryset = queryset.filter(
datetime__gt=self.date_from, datetime__lt=self.date_to
)
if self.username:
self.queryset = self.queryset.filter(username=self.username)
if self.date_from_s:
date_from = timezone.datetime.strptime(self.date_from_s, '%m/%d/%Y')
date_from = date_from.replace(
tzinfo=timezone.get_current_timezone()
)
self.queryset = self.queryset.filter(datetime__gt=date_from)
if self.date_to_s:
date_to = timezone.datetime.strptime(
self.date_to_s + ' 23:59:59', '%m/%d/%Y %H:%M:%S'
)
date_to = date_to.replace(
tzinfo=timezone.get_current_timezone()
)
self.queryset = self.queryset.filter(datetime__lt=date_to)
queryset = self.queryset.filter(username=self.username)
if self.keyword:
self.queryset = self.queryset.filter(
queryset = self.queryset.filter(
Q(ip__contains=self.keyword) |
Q(city__contains=self.keyword) |
Q(username__contains=self.keyword)
)
return self.queryset
return queryset
def get_context_data(self, **kwargs):
context = {
'app': _('Users'),
'action': _('Login log list'),
'date_from': self.date_from_s,
'date_to': self.date_to_s,
'date_from': self.date_from,
'date_to': self.date_to,
'username': self.username,
'keyword': self.keyword,
'user_list': set(LoginLog.objects.all().values_list('username', flat=True))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment