-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from MomsPops/friends_michael
Accounts friends michael
- Loading branch information
Showing
18 changed files
with
707 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"user": { | ||
"username": "michael7nightingale", | ||
"password": "password", | ||
"first_name": "Michael", | ||
"last_name": "Nightingale", | ||
"email": "nightingalemichael820@gmail.com" | ||
} | ||
}, | ||
{ | ||
"user": { | ||
"username": "suslanmopl", | ||
"password": "password", | ||
"first_name": "Suslan", | ||
"last_name": "Mopl", | ||
"email": "suslanchikmopl@gmail.com" | ||
} | ||
} | ||
] |
Empty file.
Empty file.
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,18 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.db import IntegrityError | ||
import json | ||
|
||
from users.models import Account | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Creates account with users and profiles from test data." | ||
|
||
def handle(self, *args, **options): | ||
with open("users/data/accounts.json") as file: | ||
for account_data in json.load(file): | ||
try: | ||
account = Account.objects.create_account(**account_data) | ||
Account.objects.activate(account) | ||
except IntegrityError: | ||
print(f"Account {account_data['user']['username']} already exists.") |
Oops, something went wrong.