2011-04-20 01:02:33 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
"""
|
|
|
|
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
2011-04-15 23:38:12 +02:00
|
|
|
|
2011-04-20 01:02:33 +02:00
|
|
|
See LICENSE for details.
|
|
|
|
|
2016-10-23 22:09:17 +02:00
|
|
|
create_usersettings.py - Easy way to create helpdesk-specific settings for
|
2011-04-20 01:02:33 +02:00
|
|
|
users who don't yet have them.
|
|
|
|
"""
|
2011-04-15 23:38:12 +02:00
|
|
|
|
2022-03-17 03:29:09 +01:00
|
|
|
from django.utils.translation import gettext as _
|
2011-04-15 23:38:12 +02:00
|
|
|
from django.core.management.base import BaseCommand
|
2016-10-21 17:14:12 +02:00
|
|
|
from django.contrib.auth import get_user_model
|
2011-04-15 23:38:12 +02:00
|
|
|
|
|
|
|
from helpdesk.models import UserSettings
|
|
|
|
|
2016-10-21 17:14:12 +02:00
|
|
|
User = get_user_model()
|
|
|
|
|
|
|
|
|
2011-04-15 23:38:12 +02:00
|
|
|
class Command(BaseCommand):
|
2016-10-21 17:14:12 +02:00
|
|
|
"""create_usersettings command"""
|
2011-04-15 23:38:12 +02:00
|
|
|
|
|
|
|
help = _('Check for user without django-helpdesk UserSettings '
|
2011-04-20 01:02:33 +02:00
|
|
|
'and create settings if required. Uses '
|
|
|
|
'settings.DEFAULT_USER_SETTINGS which can be overridden to '
|
|
|
|
'suit your situation.')
|
2011-04-15 23:38:12 +02:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2016-10-21 17:14:12 +02:00
|
|
|
"""handle command line"""
|
2011-04-15 23:38:12 +02:00
|
|
|
for u in User.objects.all():
|
2018-10-05 14:54:22 +02:00
|
|
|
UserSettings.objects.get_or_create(user=u)
|