forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 2781-as-a-developer-i-want-to-have-docume…
…ntation-on-django-migration-best-practices
- Loading branch information
Showing
10 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tdrs-backend/tdpservice/users/management/commands/generate_dev_user.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
"""generate_dev_user command.""" | ||
|
||
from django.contrib.auth import get_user_model | ||
from django.contrib.auth.models import Group | ||
from django.core.management import BaseCommand | ||
|
||
User = get_user_model() | ||
|
||
email = "[email protected]" | ||
pswd = "pass" | ||
first = "Jon" | ||
last = "Tester" | ||
|
||
class Command(BaseCommand): | ||
"""Command class.""" | ||
|
||
def handle(self, *args, **options): | ||
"""Generate dev user if it doesn't exist.""" | ||
try: | ||
user = User.objects.get(username=email) | ||
print(f"Found {vars(user)}") | ||
except User.DoesNotExist: | ||
group = Group.objects.get(name="Developer") | ||
user = User.objects.create(username=email, | ||
email=email, | ||
password=pswd, | ||
is_superuser=True, | ||
is_staff=True, | ||
first_name=first, | ||
last_name=last, | ||
stt_id=31, | ||
account_approval_status="Approved") | ||
user.groups.add(group) | ||
print(f"Created {vars(user)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
# WARNING: This file is checked in to source control, do NOT store any secrets in this file | ||
# | ||
|
||
# Uncomment for local dev only! | ||
#[email protected] | ||
|
||
# The hostname behind the tdrs-backend Django app | ||
REACT_APP_BACKEND_HOST=http://127.0.0.1:8080 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters