Skip to content

Give superuser privileges to a user #1530

Closed

Description

@ihsaan-ullah

When I try to use shell_plus as mentioned here: https://github.com/codalab/codabench/wiki/Administrator-procedures#give-superuser-privileges-to-an-user

docker-compose exec django ./manage.py shell_plus

I get this error:

# Shell Plus Model Imports
from analytics.models import AdminStorageDataPoint, CompetitionStorageDataPoint, StorageUsageHistory, UserStorageDataPoint
from announcements.models import Announcement, NewsPost
from competitions.models import Competition, CompetitionCreationTaskStatus, CompetitionDump, CompetitionParticipant, CompetitionWhiteListEmail, Page, Phase, PhaseTaskInstance, Submission, SubmissionDetails
from datasets.models import Data, DataGroup
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import Group, Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.sessions.models import Session
from django.contrib.sites.models import Site
from forums.models import Forum, Post, Thread
from leaderboards.models import Column, Leaderboard, SubmissionScore
from oauth2_provider.models import AccessToken, Application, Grant, RefreshToken
from oidc_configurations.models import Auth_Organization
from profiles.models import GithubUserInfo, Membership, Organization, User
from queues.models import Queue
from rest_framework.authtoken.models import Token
from social_django.models import Association, Code, Nonce, Partial, UserSocialAuth
from tasks.models import Solution, Task
# Shell Plus Django Imports
from django.core.cache import cache
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
from django.db.models import Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When, Exists, OuterRef, Subquery
from django.utils import timezone
from django.urls import reverse

Traceback (most recent call last):
  File "/app/./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django_extensions/management/commands/shell_plus.py", line 125, in run_from_argv
    return super(Command, self).run_from_argv(argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django_extensions/management/utils.py", line 62, in inner
    ret = func(self, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django_extensions/management/commands/shell_plus.py", line 517, in handle
    shell()
  File "/usr/local/lib/python3.9/site-packages/django_extensions/management/commands/shell_plus.py", line 322, in run_bpython
    embed(imported_objects, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/bpython/__init__.py", line 38, in embed
    return main(args, locals_, banner)
  File "/usr/local/lib/python3.9/site-packages/bpython/curtsies.py", line 191, in main
    exit_value = repl.mainloop(True, paste)
  File "/usr/local/lib/python3.9/site-packages/bpython/curtsies.py", line 108, in mainloop
    self.initialize_interp()
  File "/usr/local/lib/python3.9/site-packages/bpython/curtsiesfrontend/repl.py", line 1713, in initialize_interp
    del self.coderunner.interp.locals['_Helper']
KeyError: '_Helper'

I can use ipython flavour:

docker-compose exec django ./manage.py shell_plus --ipython

Activity

  1. changed the title [-]Give superuser privileges to an user[/-] [+]Give superuser privileges to a user[/+] on Jul 15, 2024
  2. Didayolo commented on Jul 15, 2024

    @Didayolo
    Member

    Yes, I had to use docker-compose exec django ./manage.py shell_plus --plain to make it work.

    It was supposed to be solved by #814.

  3. ihsaan-ullah commented on Jul 16, 2024

    @ihsaan-ullah
    CollaboratorAuthor

    Do we want to fix this or update the documentation with --plain flag?

  4. Didayolo commented on Jul 16, 2024

    @Didayolo
    Member

    Maybe we want to understand what it is broken, it was working in the past.

  5. self-assigned this
    on Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions