-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
27 lines (22 loc) · 811 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import django
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'desafio_estoque.settings')
django.setup()
def main():
from django.core.management import call_command
from django.db import migrations, models, transaction
from django.contrib.auth.models import User
call_command("migrate", interactive=False)
with transaction.atomic():
user = User.objects.create_user('manager_user', password='123456')
user.is_superuser = True
user.is_staff = True
user.profile.coffeex_manager = True
user.save()
user = User.objects.create_user('normal_user', password='123456')
user.is_superuser = True
user.is_staff = True
user.profile.coffeex_manager = False
user.save()
if __name__ == '__main__':
main()