Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
AUTH_USER_MODEL
is now CapUserAUTH_USER_MODEL
as its user field, so this means we can drop our implementation of it (APIToken is gone)create_superuser
methodis_superuser
andis_staff
have access to admin.is_staff
can see capapi models (currently just capuser).is_staff
can authenticate capusers.This pull request requires a long and arduous merging process, since Django is not friendly to changing one's mind about
AUTH_USER_MODEL
mid-project (https://docs.djangoproject.com/en/2.0/topics/auth/customizing/#changing-to-a-custom-user-model-mid-project).This patch requires that we cleanly drop all users and have people re-register which is something we can get away with since we are early in the process with cap api (assuming we have ~3 users, all internal). This is a major change but if we don't start from a clean slate, making these seemingly mundane alterations to users will become an uphill battle. The below steps will outline this recommendations.
Here are the steps, as best as I can ascertain, since there were several false starts with this (see this for further information: https://code.djangoproject.com/ticket/25313):
truncate django_migrations;
drop table "capapi_apiuser" cascade;
drop table "capapi_apitoken";
drop table "django_admin_log";
***drop table "authtoken_token";
*** locally, the only admin changes I had were of authenticating users. This step will not be right if the django_admin_log table is used for anything important.
make sure
./manage.py showmigrations
shows that nothing is migrated./manage.py migrate capapi
./manage.py migrate admin —fake-initial
./manage.py migrate