diff --git a/apps/assets/templates/assets/asset_list.html b/apps/assets/templates/assets/asset_list.html index 4933b26e2ec3ac6402c18d370c584fb1233b7ccb..553014de2f578c798520b8c32f6a732699054ed4 100644 --- a/apps/assets/templates/assets/asset_list.html +++ b/apps/assets/templates/assets/asset_list.html @@ -2,6 +2,12 @@ {% load static %} {% load i18n %} +{% block help_message %} +
+{% endblock %} + {% block custom_head_css_js %} @@ -321,12 +327,6 @@ function onDrag(event, treeId, treeNodes) { } function onDrop(event, treeId, treeNodes, targetNode, moveType) { - console.log("DROP"); - console.log(event); - console.log(treeNodes); - console.log(targetNode); - console.log(moveType); - var treeNodesNames = []; var treeNodesIds = []; $.each(treeNodes, function (index, value) { diff --git a/apps/common/mixins.py b/apps/common/mixins.py index 57509af6cf1944170b6691b4807181881fada22a..243ee93c67469277150b660f7a2ae0313034a615 100644 --- a/apps/common/mixins.py +++ b/apps/common/mixins.py @@ -99,9 +99,8 @@ class DatetimeSearchMixin: if date_from_s: date_from = timezone.datetime.strptime(date_from_s, self.date_format) - self.date_from = date_from.replace( - tzinfo=timezone.get_current_timezone() - ) + tz = timezone.get_current_timezone() + self.date_from = tz.localize(date_from) else: self.date_from = timezone.now() - timezone.timedelta(7) diff --git a/apps/common/templatetags/common_tags.py b/apps/common/templatetags/common_tags.py index 74786843007591efad018809f01bea6413e1e974..9123ecef81adb50b32168399a04a3b2558ca09b8 100644 --- a/apps/common/templatetags/common_tags.py +++ b/apps/common/templatetags/common_tags.py @@ -73,17 +73,20 @@ def to_html(s): @register.filter def time_util_with_seconds(date_from, date_to): - if date_from and date_to: - delta = date_to - date_from - seconds = delta.seconds - if seconds < 60: - return '{} s'.format(seconds) - elif seconds < 60*60: - return '{} m'.format(seconds//60) - else: - return '{} h'.format(seconds//3600) - else: + if not date_from: + return '' + if not date_to: return '' + date_to = timezone.now() + + delta = date_to - date_from + seconds = delta.seconds + if seconds < 60: + return '{} s'.format(seconds) + elif seconds < 60*60: + return '{} m'.format(seconds//60) + else: + return '{} h'.format(seconds//3600) @register.filter diff --git a/apps/templates/_header_bar.html b/apps/templates/_header_bar.html index 9c72fe38bfda97ca4026d21d9579dce9e0810bb2..712f2eece8d3a4c1c22322b450b7a7535de6f743 100644 --- a/apps/templates/_header_bar.html +++ b/apps/templates/_header_bar.html @@ -14,7 +14,7 @@ {# #} {# #}+ Demo账号: admin 密码: admin +
+ {% endif %} + {% trans 'Forgot password' %}? --
diff --git a/apps/users/views/login.py b/apps/users/views/login.py index 10ad697ba0a5068f49096142a1e51d604ff1715b..671bdf8ce3fdc941f02cc675ee68c4756c2f7aeb 100644 --- a/apps/users/views/login.py +++ b/apps/users/views/login.py @@ -1,6 +1,7 @@ # ~*~ coding: utf-8 ~*~ from __future__ import unicode_literals +import os from django import forms from django.shortcuts import render from django.contrib.auth import login as auth_login, logout as auth_logout @@ -75,6 +76,13 @@ class UserLoginView(FormView): self.redirect_field_name, self.request.GET.get(self.redirect_field_name, reverse('index'))) + def get_context_data(self, **kwargs): + context = { + 'demo_mode': os.environ.get("DEMO_MODE"), + } + kwargs.update(context) + return super().get_context_data(**kwargs) + @method_decorator(never_cache, name='dispatch') class UserLogoutView(TemplateView): @@ -237,7 +245,7 @@ class LoginLogListView(DatetimeSearchMixin, ListView): if self.user: queryset = queryset.filter(username=self.user) if self.keyword: - queryset = self.queryset.filter( + queryset = queryset.filter( Q(ip__contains=self.keyword) | Q(city__contains=self.keyword) | Q(username__contains=self.keyword)