Commit d9793d72 authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

management.commands: Use new base class for command

Fixes #1
parent 7df385d3
from django.core.management.base import NoArgsCommand
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand
from fountain.ldap import Ldap
from django.contrib.auth import get_user_model
class Command(NoArgsCommand):
class Command(BaseCommand):
help = "Updates the attributes from all current Django users from a LDAP server."
def handle_noargs(self, **options):
def handle(self, *args, **options):
verbosity = options.get('verbosity')
User = get_user_model()
l = Ldap()
values = list(l.LDAP_SYNC_USER_ATTRIBUTES.values())
values.append(User.USERNAME_FIELD)
for user_dict in User.objects.all().values(*values).iterator():
......
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