mirror of
https://github.com/himool/HimoolERP.git
synced 2024-11-15 11:58:42 +08:00
20 lines
682 B
Python
20 lines
682 B
Python
|
from django.contrib.auth.hashers import make_password
|
||
|
from django.db import transaction
|
||
|
from apps.system.models import *
|
||
|
from apps.data.models import *
|
||
|
import pendulum
|
||
|
|
||
|
|
||
|
def run(*args):
|
||
|
number = input('编号: ')
|
||
|
username = input('用户名: ')
|
||
|
password = input('密码: ')
|
||
|
name = input('名称: ')
|
||
|
activation_days = input('激活天数: ')
|
||
|
expiry_time = pendulum.now().add(days=float(activation_days))
|
||
|
|
||
|
with transaction.atomic():
|
||
|
team = Team.objects.create(number=number, expiry_time=expiry_time)
|
||
|
User.objects.create(team=team, username=username, password=make_password(password),
|
||
|
name=name, is_manager=True)
|