def handle(self, *args, **options): if not settings.NMTK_SERVER: raise CommandError('The NMTK Server is not currently enabled') if args: qs = User.objects.filter(username__in=args) else: qs = User.objects.all() if qs.exists(): for user in qs: if user.datafile_set.count() == 0: print "Setting up default files for user '%s'" % (user.username,) setupAccount(user) else: print "User '%s' already has files." % (user.username,) else: print "No users found!"
def handle(self, *args, **options): if not settings.NMTK_SERVER: raise CommandError('The NMTK Server is not currently enabled') if args: qs = User.objects.filter(username__in=args) else: qs = User.objects.all() if qs.exists(): for user in qs: if user.datafile_set.count() == 0: print "Setting up default files for user '%s'" % ( user.username, ) setupAccount(user) else: print "User '%s' already has files." % (user.username, ) else: print "No users found!"
def create_user_profile(sender, instance, created, **kwargs): from NMTK_server.models import UserPreference if created: setupAccount(instance) UserPreference.objects.create(user=instance, config=json.dumps({}))