예제 #1
0
 def save(self, **kwargs):
     client = Client(name=self.validated_data["name"],
                     email=self.validated_data["email"])
     client.save()
     message = Message(client_sender=client,
                       title=self.validated_data["title"],
                       content=self.validated_data["content"])
     message.save()
     return message
 def save(self, commit=True):
     user = User.objects.create_user(
         username=self.cleaned_data["username"],
         password=self.cleaned_data['password1'],
         email=self.cleaned_data['email'],
     )
     client = Client(user=user)
     user.save()
     client.save()
     return client
예제 #3
0
    def post(self):
        """
        Register user
        """
        data = request.json

        if Client.search().query(
                'match',
                client_id=data['client_id']).execute().hits.total != 0:
            abort(400, error='Client id already exist')

        if Client.search().query(
                'match', email=data['email']).execute().hits.total != 0:
            abort(400, error='Email already exist')

        if not re.match(r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)",
                        data['email']):
            abort(400, error='{0} not pass email regex.'.format(data['email']))

        user = Client(client_id=data['client_id'],
                      email=data['email'],
                      secret=data['client_secret'],
                      balance=0,
                      confirmed=False)

        try:
            serializer = URLSafeTimedSerializer(
                current_app.config['PRIVATE_KEY'])
            token = serializer.dumps(user.email,
                                     salt=current_app.config['SALT_KEY'])

            payload = {
                'confirm_token': token,
                'confirm_url': current_app.config['CONFIRM_BASE_URL'] + token,
            }

            msg = Message(recipients=[data['email']],
                          html=render_email('register.html', payload),
                          subject='Register')

            mail.send(msg)

            user.save()

            return 'Client successfully registered', 200

        except Exception as ex:
            current_app.logger.error(
                'Unable to register user --> {0}'.format(ex))
            abort(
                400,
                error='Unable to register user, please contact administrator')
예제 #4
0
    def test_get_existing_client_without_uuid(self):
        ip = '192.168.2.3'
        client = Client(ip=ip, user_agent='tester_existing', uuid=None)
        client.save()

        other = Client(ip=ip, user_agent='tester_existing 2', uuid=None)
        other.save()

        request = HttpRequest()
        # noinspection PyPropertyAccess
        request.headers = {'User-Agent': 'tester_existing'}
        request.META = {'REMOTE_ADDR': ip}
        self.assertEquals(client, get_client(request))
예제 #5
0
def entry_page(request):
    if request.user.is_authenticated:
        return redirect("home")

    if request.method == "POST":
        if "email" in request.POST:
            form = RegisterForm(data=request.POST)
            if form.is_valid():
                user = form.save()
                user.refresh_from_db()
                user.save()
                client = Client(user=user)
                client.save()
                name = user.username
                topic = Topic.objects.get(name="Personal")
                is_public = True
                blog = Blog(name=name, isPublic=is_public)
                blog.save()
                blog.owner.add(client.id)
                blog.subs.add(client.id)
                blog.topic.add(topic.id)
                blog.save()
                login(request, user)
                return redirect('/my_profile')
            else:
                print(form.errors)
                return render(request, "entry_page.html",
                              {"form_login": LoginForm(), "form_register": RegisterForm(), "form_errors": form.errors})

        elif "username" in request.POST:
            form = LoginForm(data=request.POST)
            if form.is_valid():
                username = form.cleaned_data.get('username')
                raw_password = form.cleaned_data.get('password')
                user = authenticate(username=username, password=raw_password)
                if user is not None:
                    login(request, user)
                    return redirect('home')
                # passar os dados do utilizador
            else:
                print(form.errors)
                return render(request, "entry_page.html",
                              {"form_login": LoginForm(), "form_register": RegisterForm(), "form_errors2": form.errors})

        else:
            return render(request, "entry_page.html", {"form_login": LoginForm(), "form_register": RegisterForm()})

    elif request.method == "GET":
        return render(request, "entry_page.html", {"form_login": LoginForm(), "form_register": RegisterForm()})
예제 #6
0
def RandomClient(faker):
    client = Client()
    sex = 'male'
    active = True
    if random.randrange(1,2) == 1:
        sex = 'female'
    if random.randrange(1,10) == 1:
        active = False
    profile = faker.profile(fields=['username','password','mail','address'],sex=sex)
    client.username = profile['username']
    client.email = profile['mail']
    client.password = faker.md5(raw_output=False)
    client.active = active
    client.created = faker.date_object()
    client.save()
예제 #7
0
파일: schema.py 프로젝트: drproteus/crusher
 def mutate(
     cls,
     root,
     info,
     data,
     uid=None,
 ):
     try:
         client = ClientModel.objects.get(pk=uid)
     except ClientModel.DoesNotExist:
         client = ClientModel()
     for k, v in data.items():
         if v is not None:
             setattr(client, k, v)
     client.save()
     return ModifyClientMutation(client=client)
예제 #8
0
파일: signals.py 프로젝트: ojengwa/apipanda
def add_to_org(sender, **kwargs):
    org = sender.objects.last()
    user = org.creator

    member, created = OrganisationMember.objects.get_or_create(org=org,
                                                               member=user)

    if created:
        tld = tldextract.extract(org.url)

        client = Client()
        client.name = org.name
        client.organisation = org
        client.schema_name = org.slug
        client.paid_until = datetime.now() + timedelta(days=90)
        try:
            client.domain_url = tld.domain
            client.save()
        except KeyError:
            try:
                client.domain_url = tld.domain + '-' + tld.subdomain
                client.save()
            except KeyError:
                client.domain_url = org.slug
                client.save()
예제 #9
0
파일: signals.py 프로젝트: ojengwa/apipanda
def add_to_org(sender, **kwargs):
    org = sender.objects.last()
    user = org.creator

    member, created = OrganisationMember.objects.get_or_create(
        org=org, member=user)

    if created:
        tld = tldextract.extract(org.url)

        client = Client()
        client.name = org.name
        client.organisation = org
        client.schema_name = org.slug
        client.paid_until = datetime.now() + timedelta(days=90)
        try:
            client.domain_url = tld.domain
            client.save()
        except KeyError:
            try:
                client.domain_url = tld.domain + '-' + tld.subdomain
                client.save()
            except KeyError:
                client.domain_url = org.slug
                client.save()
예제 #10
0
파일: views.py 프로젝트: LaurenUnq/Piscine
def signup_client(request):
    if request.method == 'POST':
        form = SignUpFormClient(request.POST)
        if form.is_valid():
            form.save() #Sauvegarde/Creation d'un utilisateur de base
            username = form.cleaned_data.get('username')
            raw_password = form.cleaned_data.get('password1')
            user = authenticate(username=username, password=raw_password) #Authentification de l'utilisateur
            Utilisateur = User.objects.get(username=username)
            groupe_client = Group.objects.get(id='2')  # On ajoute l'utilisateur au groupe client ici (id groupe client = 2 )
            Utilisateur.groups.add(groupe_client)
            client = Client(numclient=Utilisateur, datenaissanceclient=form.cleaned_data.get('datenaissanceclient'), telephoneclient=form.cleaned_data.get('telephoneclient'), codepostalclient=form.cleaned_data.get('codepostalclient'), villeclient=form.cleaned_data.get('villeclient'), rueclient=form.cleaned_data.get('rueclient'), numclient_id=Utilisateur.id)
            client.save()  # Sauvegarde du client
            login(request, user) #Connexion au site
            estClient = True
            request.session['estClient'] = estClient  # On mémorise le fait que c'est un client en session
            request = init_panier(request)
            request = init_reservation(request) #On initiliase le panier et le panier_reservation de l'utilisateur
            return redirect('homepage')
    else:
        form = SignUpFormClient(request.POST)
    return render(request, 'signup_client.html', {'formClient': form})
예제 #11
0
파일: stock.py 프로젝트: dcorquir/Stock_GHA
    def post(self, request, *args, **kwargs):
        try:
            code = request.POST['code']
            name_client = request.POST['name_client']
            nit_client = request.POST['nit_client']
            address_client = request.POST['address_client']
            city_client = request.POST['city_client']
            prd_type = request.POST['prd_type']
            description = request.POST['description']

            try:
                client_exist = Client.objects.get(nit=nit_client)
                client = client_exist
            except Exception:
                client = Client(name=name_client,
                                nit=nit_client,
                                city=city_client,
                                address=address_client)
                client.save()

            try:
                product_type = TypeProductHistory.objects.get(name=prd_type)
                type_product = product_type
            except Exception:
                type_product = TypeProductHistory(name=prd_type)
                type_product.save()

            project = Project(client=client,
                              description=description,
                              type_product=type_product,
                              code=code)
            project.save()
            messages.success(request, 'Se ha creado el projecto correctamente')
        except Exception:
            messages.error(
                request, 'Ha ocurrido un error interno, por favor verifique '
                'e intentelo de nueo')
        return redirect('projects')
    def handle(self, *args, **options):
        print("Creating users")
        fake = Faker()
        uniq = set()
        index = 0
        count = options['count']
        while index < count:
            profile = fake.profile()

            username = profile['username']
            if username not in uniq:
                u = User.objects.create_user(
                    username=username,
                    password=profile['mail'],
                    email=profile['mail']
                )

                user = Client(
                    user=u,
                    rating=randint(0, 100)
                )
                user.save()
                uniq.add(username)
                index += 1
예제 #13
0
def get_client(request):
    """
    Get a client or create if not exists
    :param request:
    :return:
    """
    uuid = request.headers.get('X-CLIENT-UUID')
    client_ip = get_client_ip(request)
    user_agent = request.headers.get('User-Agent')

    if uuid and Client.objects.filter(uuid=uuid, uuid__isnull=False).exists():
        return Client.objects.get(uuid=uuid, uuid__isnull=False)
    else:
        if Client.objects.filter(uuid__isnull=True,
                                 ip=client_ip,
                                 user_agent=user_agent).exists():
            return Client.objects.get(uuid__isnull=True,
                                      ip=client_ip,
                                      user_agent=user_agent)
        else:
            client = Client(uuid=uuid, ip=client_ip, user_agent=user_agent)
            client.save()
            logger.info('[+] new client : {}'.format(client))
            return client
예제 #14
0
파일: views.py 프로젝트: karpp/OrderTracker
def create_process():
    if session.get('id', '') == '':
        return redirect('/business/')
    elif not Business.check_confirmed(session.get('id', '')):
        return redirect('/business/unconfirmed')
    b_id = session['id']
    form = CreateProcessForm()
    s_form = SelectFieldTypeForm()
    h = HelpForm()
    s_form.select_type.choices = [(p.id, p.type) for p in PossibleProcess.query.filter_by(business_id=b_id).all()]
    d_form = DateForm()

    if form.validate_on_submit() and d_form.validate_on_submit():

        if Client.email_is_free(form.client_email.data):
            client = Client(form.client_email.data)
            cl_id = client.save()
        else:
            cl_id = Client.get_id(form.client_email.data)
        client_password = Client.random_password(10)
        number = Process.random_number()
        process = Process(s_form.select_type.data, form.description.data, b_id, cl_id, number, form.price.data,
                          client_password,
                          d_form.dt.data, 0)
        pr_id = process.save()
        id_stage = Stage.get_not_started(s_form.select_type.data)
        process = Process.query.filter_by(id=pr_id).first()
        process.current_stage = id_stage
        chat = Chat(pr_id, b_id)
        chat.save()
        process.save()

        Process.send_number(form.client_email.data, Business.get_name(b_id), number, client_password)

        # string = "Услуга была создана под номером: " + number
        return redirect(url_for('business.created_process', process_id=pr_id))
    elif form.validate_on_submit() and not d_form.validate_on_submit():
        d_form.dt.errors = ("Выберите дату", "")

    h.desc.choices = [(p.desc, p.desc) for p in PossibleProcess.query.filter_by(business_id=b_id).all()]
    h.price.choices = [(p.price, p.price) for p in PossibleProcess.query.filter_by(business_id=b_id).all()]
    h.pic.choices = [(p.picture, p.picture) for p in PossibleProcess.query.filter_by(business_id=b_id).all()]
    return render_template('create_process.html', form=form, h=h, s_form=s_form, d_form=d_form, title='Создание заказа')
예제 #15
0
def ack(client: Client) -> None:
    client.current_offset.ack = True
    client.current_offset.save()
    client.current_offset = None
    client.save()
예제 #16
0
class Test(TestCase):

    # noinspection PyAttributeOutsideInit
    def setUp(self):
        self.domain = Domain(name='victim', chunk_size=256)
        self.domain.save()

        self.first_client = Client(ip='129.168.0.1', user_agent='tester')
        self.first_client.save()

        self.second_client = Client(ip='129.168.0.1', user_agent='tester')
        self.second_client.save()

        self.bogged_client = Client(ip='129.168.0.2',
                                    user_agent='bogged tester')
        self.bogged_client.save()

    def test_create_client_without_uuid_client(self):
        client = Client(ip='129.168.0.1', user_agent='tester', uuid=None)
        client.save()

    def test_create_client_without_useragent_client(self):
        client = Client(ip='129.168.0.1', user_agent=None)
        client.save()

    def test_create_client(self):
        uuid = 'da8e4c40-8c10-4f97-b109-d17ec8ad9960'
        user_agent = 'Mozilla/5.0 (Linux; U; Android 2.2) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile ' \
                     'Safari/533.1 '
        ip = '192.168.2.3'
        request = HttpRequest()
        # noinspection PyPropertyAccess
        request.headers = {'User-Agent': user_agent, 'X-CLIENT-UUID': uuid}
        request.META = {'REMOTE_ADDR': ip}
        client = get_client(request)
        self.assertEquals(client.ip, ip)
        self.assertEquals(client.user_agent, user_agent)
        self.assertEquals(client.uuid, uuid)

    def test_create_client_without_uuid(self):
        request = HttpRequest()
        # noinspection PyPropertyAccess
        request.headers = {'User-Agent': 'nouuid'}
        request.META = {'REMOTE_ADDR': '192.168.2.3'}
        client = get_client(request)
        self.assertEquals(client.ip, '192.168.2.3')
        self.assertEquals(client.user_agent, 'nouuid')
        self.assertIsNone(client.uuid)

    def test_create_client_without_user_agent(self):
        request = HttpRequest()
        # noinspection PyPropertyAccess
        request.headers = {}
        request.META = {'REMOTE_ADDR': '192.168.2.3'}
        client = get_client(request)
        self.assertEquals(client.ip, '192.168.2.3')
        self.assertIsNone(client.user_agent)

    def test_get_existing_client_without_uuid(self):
        ip = '192.168.2.3'
        client = Client(ip=ip, user_agent='tester_existing', uuid=None)
        client.save()

        other = Client(ip=ip, user_agent='tester_existing 2', uuid=None)
        other.save()

        request = HttpRequest()
        # noinspection PyPropertyAccess
        request.headers = {'User-Agent': 'tester_existing'}
        request.META = {'REMOTE_ADDR': ip}
        self.assertEquals(client, get_client(request))
예제 #17
0
import os
from app import create_app


basedir = os.path.abspath(os.path.dirname(__file__))

if __name__ == '__main__':
    flask_app = create_app(os.environ.get('APP_CONFIG', 'default'))

    with flask_app.test_request_context():
        from app.models import Client, Book, BookOffer

        Client.init()
        Book.init()
        BookOffer.init()

        response = Client.search().execute()
        if Client.search().execute().hits.total == 0:
            admin = Client(
                client_id='rastadev',
                secret='rastadev',
                email='*****@*****.**',
                confirmed=True,
                favorite_genders=['chill', 'science'],
                balance=999999999
            )
            admin.save()
            print('admin created')
예제 #18
0
 def test_create_client_without_useragent_client(self):
     client = Client(ip='129.168.0.1', user_agent=None)
     client.save()
예제 #19
0
 def test_func_save(self):
     client = Client(email='email')
     client.save()
     committed_client = Client.query.get(client.id)
     self.assertEqual(committed_client, client)
예제 #20
0
from app.models import Client

# create your public tenant
tenant = Client(domain_url='localhost', # don't add your port or www here! on a local server you'll want to use localhost here
                schema_name='public',
                name='Schemas Inc.',
                paid_until='2016-12-05',
                on_trial=False)
tenant.save()
예제 #21
0
def initial(request):
    if Company.objects.count() == 0:
        Company.objects.create(name="pushe")

    Criteria.objects.all().delete()
    my_tickets = Criteria.objects.create(name="My Tickets")
    i_follow = Criteria.objects.create(name="Tickets I Follow")
    my_team = Criteria.objects.create(name="My Team's Tickets")
    unassigned = Criteria.objects.create(name="Unassigned Tickets")
    all = Criteria.objects.create(name="All Tickets")

    clause_my_tickets = CriteriaClause.objects.create(criteria=my_tickets)
    clause_i_follow = CriteriaClause.objects.create(criteria=i_follow)
    clause_my_team = CriteriaClause.objects.create(criteria=my_team)
    clause_unassigned = CriteriaClause.objects.create(criteria=unassigned)
    clause_all = CriteriaClause.objects.create(criteria=all)

    single_my_tickets = SingleCriteria.objects.create(
        criteria_clause=clause_my_tickets,
        field="assigned_to",
        operation="is",
        value="shooka_current_agent")
    single_i_follow = SingleCriteria.objects.create(
        criteria_clause=clause_i_follow,
        field="followers",
        operation="is",
        value="shooka_current_agent")
    single_my_team = SingleCriteria.objects.create(
        criteria_clause=clause_my_team,
        field="assigned_team",
        operation="is",
        value="shooka_current_agent_team")
    single_unassigned = SingleCriteria.objects.create(
        criteria_clause=clause_unassigned,
        field="assigned_to",
        operation="isnull",
        value="True",
        value_type="boolean")
    single_all = SingleCriteria.objects.create(criteria_clause=clause_all,
                                               field="pk",
                                               operation="isnull",
                                               value="",
                                               value_type="boolean")

    if User.objects.count() == 0:
        user = User.objects.create(first_name="amirhossein",
                                   email="*****@*****.**",
                                   username="******",
                                   company=Company.objects.first(),
                                   is_staff=True,
                                   is_superuser=True)
        user.set_password("123123")
        user.save()

    Client.objects.all().delete()
    Message.objects.all().delete()
    Ticket.objects.all().delete()

    for i in range(100):
        client_profile = ClientProfile(name=generate_text(5) + "client")
        client_profile.save()
        client = Client(profile=client_profile,
                        email=generate_text(5) + "@gmail.com")
        client.save()
        message = Message(client_sender=client,
                          title=generate_text(15),
                          content='<p>' + generate_text(20) + '</p>')
        message.save()
    return HttpResponse("done")
예제 #22
0
파일: mock.py 프로젝트: karpp/OrderTracker
def mock():
    db.drop_all()
    db.create_all()

    # Первый бизнес

    business = Business(name="Туристическое агенство Маленький Принц", password="******",
                        email="*****@*****.**", confirmed=True)
    Business.save(business)

    # возможная услуга для первого бизнеса
    process = PossibleProcess("Помощь выбора путёвки", "Подбор идеального места для отдыха", 1, "10000")
    pr_id = process.save()

    stage_not_started = Stage("Не начат", 1)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 1)
    stage_finished.save()

    # стадии для этой услуги
    stage = Stage("Анкетирование", 1)
    stage.save()

    stage = Stage("Диалог с клиентом", 1)
    stage.save()

    stage = Stage("Покупка путёвки", 1)
    stage.save()

    Stage.fix_not_finished(1)

    # созданный заказ для первой услуги
    client = Client('*****@*****.**')
    client.save()

    process = Process(1, 'Подбор идеального места для отдыха', 1, 1, "AAAAAA-AAAAAA", "10000", "qweqwe")
    process.save()

    # вторая возможная услуга для первого бизнеса
    process = PossibleProcess("Собственная экскурсия",
                              "Создание экскурсии спецально по персональным требованиям клиента", 1, "20000")
    pr_id = process.save()

    # стадии для этой услуги
    stage_not_started = Stage("Не начат", 2)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 2)
    stage_finished.save()

    stage = Stage("Диалог с клиентом", 2)
    stage.save()

    stage = Stage("Поиск экукурсоводов", 2)
    stage.save()

    stage = Stage("Создание программы экскурсии", 2)
    stage.save()

    Stage.fix_not_finished(2)

    pic = Pictures(1)
    id_picture = Pictures.save(pic)
    picture = "2.jpeg"
    rows = Pictures.query.filter_by(id=id_picture).update({'picture': picture})
    rows = PossibleProcess.query.filter_by(id=2).update({'picture': picture})
    db.session.commit()

    # созданный заказ для второй услуги
    client = Client('*****@*****.**')
    client.save()

    process = Process(2, 'Предпочитает картинные галереи', 1, 2, "BBBBBB-BBBBBB", "20000", "asdasd")
    process.save()

    rows = Process.query.filter_by(id=2).update({'current_stage': 9})
    rows = Process.query.filter_by(id=2).update({'percent': round(45)})
    db.session.commit()

    # создать страницу первого бизнеса
    card = BusinessCard("Туристическое агенство Маленький Принц",
                        "Поможем Вам найти место для идеального препровождения", "Телефон: +7(924)732-90-65",
                        "метро Добрынинская", 1)
    BusinessCard.save(card)

    pic = Pictures(1)
    id_picture = Pictures.save(pic)
    picture = "1.jpg"
    rows = Pictures.query.filter_by(id=id_picture).update({'picture': picture})
    rows = BusinessCard.query.filter_by(business_id=1).update({'picture': picture})
    db.session.commit()

    # создать комментарии к бизнесу
    comments = Comments(
        "Очень доволен фирмой! Крайне приятный персонал: были вежливы и очень быстро мне подобрали место для отдыха", 1,
        1, "Александр", 5)
    Comments.save(comments)
    # еще один
    comments = Comments("Всё, конечно, хорошо, но с местом немного прогадали. Но никаких особых претензий нет", 2, 1,
                        "Анастасия", 1)
    Comments.save(comments)

    rating = BusinessCard.get_new_rating(1)
    rows = BusinessCard.query.filter_by(business_id=1).update(
        {'rating': rating})
    db.session.commit()

    # Второй бизнес

    business = Business(name="Общество историков 1984", password="******",
                        email="*****@*****.**", confirmed=True)
    Business.save(business)

    # возможная услуга для второго бизнеса
    process = PossibleProcess("Подготовка к ЕГЭ", "Курсы по подготовке к ЕГЭ по истории", 2, "30000")
    pr_id = process.save()

    stage_not_started = Stage("Не начат", 3)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 3)
    stage_finished.save()

    # стадии для этой услуги
    stage = Stage("Первый триместр", 3)
    stage.save()

    stage = Stage("Второй триместр", 3)
    stage.save()

    stage = Stage("Третий триместр", 3)
    stage.save()

    Stage.fix_not_finished(3)

    # созданный заказ для первой услуги
    client = Client('*****@*****.**')
    client.save()

    process = Process(3, 'Курсы по подготовки к ЕГЭ по истории', 2, 3, "CCCCCC-CCCCCC", "30000", "zxczxc")
    process.save()

    # вторая возможная услуга для второго бизнеса
    process = PossibleProcess("Консультирование", "Помощь в написании курсовой/докторской и прочих работ", 2, "40000")
    pr_id = process.save()

    stage_not_started = Stage("Не начат", 4)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 4)
    stage_finished.save()

    # стадии для этой услуги
    stage = Stage("Первая встреча", 4)
    stage.save()

    stage = Stage("Поиск информации", 4)
    stage.save()

    stage = Stage("Консультирование", 4)
    stage.save()

    Stage.fix_not_finished(4)

    # созданный заказ для второй услуги

    process = Process(4, 'Помощь в написании курсовой/докторской и прочих работ', 2, 1, "DDDDDD-DDDDDD", "40000",
                      "werwer")
    process.save()

    business = Business(name="Как у бабушки", password="******",
                        email="*****@*****.**", confirmed=True)
    Business.save(business)

    w = Widget(-1, 'game', 'http://0.0.0.0:8080/business/widget', 'game', 1, 3)
    w.save()

    # возможная услуга для 3 бизнеса
    process = PossibleProcess("Домашняя пицца", "Сделанная дома пицца по рецепту моей бабушки", 3, "50000")
    pr_id = process.save()

    stage_not_started = Stage("Не начат", 5)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 5)
    stage_finished.save()

    # стадии для этой услуги
    stage = Stage("Приготовление пиццы", 5)
    stage.save()

    stage = Stage("Упаковка пиццы", 5)
    stage.save()

    stage = Stage("Доставка", 5)
    stage.save()

    Stage.fix_not_finished(5)

    process = Process(5, 'Сделанная дома пицца', 3, 1, "EEEEEE-EEEEEE", "30000", "sdfsdf")
    process.save()

    # вторая возможная услуга для второго бизнеса
    process = PossibleProcess("Домашняя шаурма", "Сделанная дома шаурма по-моему рецепту", 3, "40000")
    pr_id = process.save()

    stage_not_started = Stage("Не начат", 6)
    stage_not_started.save()
    stage_finished = Stage("Закончен", 6)
    stage_finished.save()

    # стадии для этой услуги
    stage = Stage("Приготовление шаурмы", 6)
    stage.save()

    stage = Stage("Упаковка", 6)
    stage.save()

    stage = Stage("Доставка", 6)
    stage.save()

    Stage.fix_not_finished(6)

    process = Process(6, 'Сделанная дома шаурма', 3, 1, "FFFFFF-FFFFFF", "40000", "xcvxcv")
    process.save()

    process = Process(2, 'Детская экскурсия', 1, 2, "GGGGGG-GGGGGG", "25000", "ertert")
    process.save()

    rows = Process.query.filter_by(id=7).update({'current_stage': 7})
    rows = Process.query.filter_by(id=7).update({'percent': round(100)})
    db.session.commit()

    print('Success')