Skip to content

Dev_Administrator Procedures

Adrien Pavão edited this page Jun 15, 2021 · 25 revisions

Administrator procedures

Delete all contents of database

In codalab-competitions folder, on the CodaLab instance:

docker-compose up -d
docker-compose exec django bash
python manage.py reset_db
python manage.py migrate
python manage.py syncdb --migrate
exit
docker-compose restart
docker-compose up -d

Add yourself to "staff" and "superuser"

This gives access to health/simple_status and more.

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="your username")
>>> user.is_superuser = True
>>> user.is_staff = True
>>> user.save()

Erase user

/!/ First step: check the user's email address to ensure you won't erase an account under the demand of another user /!/

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="user name")    # or (email="user email")
>>> user.delete() # ??? Don't seem to work at all ???

Change username

Hint: only accept to change the username if the request is sent from the user's email address.

docker-compose exec django bash
# python manage.py shell_plus
>>> user = ClUser.objects.get(username="new_username") # check if 'new_username' already exists
>>> user = ClUser.objects.get(username="old_username")    # or (email="user email"), good to check if the person who contacted us owns the account
>>> user.username = 'new_username'
>>> user.save()
Clone this wiki locally