2016-07-03 16:11:48 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
|
|
|
|
# more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version 3
|
|
|
|
# along with this program; if not, write to the Free Software Foundation, Inc., 51
|
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# (c) 2016 Valentin Samir
|
2016-06-28 22:28:59 +00:00
|
|
|
"""Clean deleted sessions management command"""
|
2015-06-12 16:10:52 +00:00
|
|
|
from django.core.management.base import BaseCommand
|
2015-06-11 21:04:26 +00:00
|
|
|
|
|
|
|
from ... import models
|
|
|
|
|
2020-04-25 00:59:37 +00:00
|
|
|
import sys
|
|
|
|
if sys.version_info < (3,):
|
|
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
else:
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
2015-06-12 16:10:52 +00:00
|
|
|
|
2015-06-11 21:04:26 +00:00
|
|
|
class Command(BaseCommand):
|
2016-06-28 22:28:59 +00:00
|
|
|
"""Clean deleted sessions"""
|
2015-06-11 21:04:26 +00:00
|
|
|
args = ''
|
|
|
|
help = _(u"Clean deleted sessions")
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
models.User.clean_deleted_sessions()
|
2016-10-07 13:22:49 +00:00
|
|
|
models.UserAttributes.clean_old_entries()
|
2016-07-29 12:33:02 +00:00
|
|
|
models.NewVersionWarning.send_mails()
|