| 1 |
# -*- coding: utf-8 -*- |
| 2 |
# This program is distributed in the hope that it will be useful, but WITHOUT |
| 3 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 4 |
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for |
| 5 |
# more details. |
| 6 |
# |
| 7 |
# You should have received a copy of the GNU General Public License version 3 |
| 8 |
# along with this program; if not, write to the Free Software Foundation, Inc., 51 |
| 9 |
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 10 |
# |
| 11 |
# (c) 2016-2020 Valentin Samir |
| 12 |
"""Clean old trickets management command""" |
| 13 |
from django.core.management.base import BaseCommand |
| 14 |
|
| 15 |
from ... import models |
| 16 |
|
| 17 |
import sys |
| 18 |
if sys.version_info < (3, ): |
| 19 |
from django.utils.translation import ugettext_lazy as _ |
| 20 |
else: |
| 21 |
from django.utils.translation import gettext_lazy as _ |
| 22 |
|
| 23 |
|
| 24 |
class Command(BaseCommand): |
| 25 |
"""Clean old trickets""" |
| 26 |
args = '' |
| 27 |
help = _(u"Clean old tickets") |
| 28 |
|
| 29 |
def handle(self, *args, **options): |
| 30 |
models.User.clean_old_entries() |
| 31 |
for ticket_class in [models.ServiceTicket, models.ProxyTicket, models.ProxyGrantingTicket]: |
| 32 |
ticket_class.clean_old_entries() |