• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python views.get_user函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中possum.base.views.get_user函数的典型用法代码示例。如果您正苦于以下问题:Python get_user函数的具体用法?Python get_user怎么用?Python get_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: products_cooking

def products_cooking(request, product_id):
    data = get_user(request)
    product = get_object_or_404(Produit, pk=product_id)
    new = not product.choix_cuisson
    product.choix_cuisson = new
    product.save()
    return HttpResponseRedirect('/carte/products/%s/' % product_id)
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例2: products_add_categories_ok

def products_add_categories_ok(request, product_id, cat_id):
    data = get_user(request)
    product = get_object_or_404(Produit, pk=product_id)
    category = get_object_or_404(Categorie, pk=cat_id)
    product.categories_ok.add(category)
    product.save()
    return HttpResponseRedirect('/carte/products/%s/' % product_id)
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例3: sold_view

def sold_view(request, bill_id, sold_id):
    data = get_user(request)
    data['menu_bills'] = True
    data['bill_id'] = bill_id
    data['sold'] = get_object_or_404(ProduitVendu, pk=sold_id)
    return render_to_response('base/bill/sold.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:bill.py


示例4: printer_select_width

def printer_select_width(request, printer_id):
    data = get_user(request)
    data['menu_manager'] = True
    data['printer'] = get_object_or_404(Printer, pk=printer_id)
    data['max'] = range(14, 120)
    return render_to_response('base/manager/printer_select_width.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例5: categories_more_priority

def categories_more_priority(request, cat_id, nb=1):
    data = get_user(request)
    cat = get_object_or_404(Categorie, pk=cat_id)
    cat.set_more_priority(nb)
    logger.info("[%s] cat [%s] priority + %d" % (data['user'].username,
                                                 cat.nom, nb))
    return HttpResponseRedirect('/carte/categories/%s/' % cat_id)
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例6: users_change

def users_change(request, user_id):
    data = get_user(request)
    login = request.POST.get('login', '').strip()
    first_name = request.POST.get('first_name', '').strip()
    last_name = request.POST.get('last_name', '').strip()
    mail = request.POST.get('mail', '').strip()
    user = get_object_or_404(User, pk=user_id)
    if login != user.username:
        logger.info("[%s] new login: [%s] > [%s]" % (
                    data['user'].username, user.username, login))
        user.username = login
    if first_name != user.first_name:
        logger.info("[%s] new first name for [%s]: [%s] > [%s]" % (
                    data['user'].username, user.username, user.first_name,
                    first_name))
        user.first_name = first_name
    if last_name != user.last_name:
        logger.info("[%s] new last name for [%s]: [%s] > [%s]" % (
                    data['user'].username, user.username, user.last_name,
                    last_name))
        user.last_name = last_name
    if mail != user.email:
        logger.info("[%s] new mail for [%s]: [%s] > [%s]" % (
                    data['user'].username, user.username, user.email, mail))
        user.email = mail

    try:
        user.save()
    except:
        messages.add_message(request, messages.ERROR, "Les modifications n'ont"
                             " pu être enregistrées.")
        logger.warning("[%s] save failed for [%s]" % (data['user'].username,
                                                      user.username))
    return HttpResponseRedirect('/manager/users/')
开发者ID:shenyk,项目名称:possum,代码行数:34,代码来源:__init__.py


示例7: rapports_weekly

def rapports_weekly(request):
    """
    Affiche le rapport pour une semaine
    """
    data = get_user(request)
    data['menu_manager'] = True
    DailyStat().update()
    date = datetime.datetime.now()
    year = date.year
    # 01 must be converted to 1
    week = int(date.strftime("%U"))
    if request.method == 'POST':
        try:
            week = int(request.POST.get('week'))
            year = int(request.POST.get('year'))
        except:
            messages.add_message(request,
                                 messages.ERROR,
                                 "La date saisie n'est pas valide.")
    data['week_form'] = WeekForm({'year': year, 'week': week})
    data['week'] = week
    data['year'] = year
    last_year = year - 1
    data = WeeklyStat().get_data(data, year, week)
    for key in ['nb_bills', 'total_ttc', 'guests_nb', 'guests_average',
                'guests_total_ttc', 'bar_nb', 'bar_average', 'bar_total_ttc']:
        data['last_%s' % key] = "%.2f" % WeeklyStat().get_value(key, last_year, week)
        data['max_%s' % key] = WeeklyStat().get_max(key)
        data['avg_%s' % key] = WeeklyStat().get_avg(key)
    return render_to_response('base/manager/rapports/home.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:31,代码来源:__init__.py


示例8: products_add_produits_ok

def products_add_produits_ok(request, product_id, sub_id):
    data = get_user(request)
    menu = get_object_or_404(Produit, pk=product_id)
    product = get_object_or_404(Produit, pk=sub_id)
    menu.produits_ok.add(product)
    menu.save()
    return HttpResponseRedirect('/carte/products/%s/' % product_id)
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例9: factures

def factures(request):
    data = get_user(request)
    data['menu_bills'] = True
    data['need_auto_refresh'] = True
    data['factures'] = Facture().non_soldees()
    return render_to_response('base/bill/home.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:bill.py


示例10: printer_change_manager

def printer_change_manager(request, printer_id):
    data = get_user(request)
    printer = get_object_or_404(Printer, pk=printer_id)
    new = not printer.manager
    printer.manager = new
    printer.save()
    return HttpResponseRedirect('/manager/printer/%s/' % printer_id)
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例11: products_view

def products_view(request, product_id):
    data = get_user(request)
    data['product'] = get_object_or_404(Produit, pk=product_id)
    data['menu_manager'] = True
    return render_to_response('base/carte/product.html',
                                data,
                                context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:7,代码来源:__init__.py


示例12: bill_payment

def bill_payment(request, bill_id, type_id=-1, count=-1, left=0, right=0):
    data = get_user(request)
    bill = get_object_or_404(Facture, pk=bill_id)
    if bill.restant_a_payer == 0:
        messages.add_message(request, messages.ERROR, "Il n'y a rien à payer.")
        return HttpResponseRedirect('/bill/%s/' % bill.id)
    data['bill_id'] = bill_id
    data['type_payments'] = PaiementType.objects.order_by("nom")
    data['menu_bills'] = True
    data['left'] = left
    data['right'] = right
    if type_id > -1:
        data['type_selected'] = get_object_or_404(PaiementType, pk=type_id)
        if data['type_selected'].fixed_value:
            if count > 0:
                data['tickets_count'] = count
            else:
                data['tickets_count'] = 0
            data['ticket_value'] = "0.0"
        else:
            if left == 0 and right == 0:
                montant = u"%.2f" % bill.restant_a_payer
                (data['left'], data['right']) = montant.split(".")
    return render_to_response('base/bill/payment.html',
                                data,
                                context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:26,代码来源:bill_payment.py


示例13: rapports_monthly

def rapports_monthly(request):
    """
    Affiche le rapport pour un mois
    """
    data = get_user(request)
    data['menu_manager'] = True
    DailyStat().update()
    date = datetime.datetime.now()
    year = date.year
    month = date.month
    if request.method == 'POST':
        try:
            month = int(request.POST.get('month'))
            year = int(request.POST.get('year'))
        except:
            messages.add_message(request,
                                 messages.ERROR,
                                 "La date saisie n'est pas valide.")
    data['month_form'] = MonthForm({'year': year, 'month': month})
    data['month'] = month
    data['year'] = year
    last_year = year - 1
    data = MonthlyStat().get_data(data, year, month)
    for key in ['nb_bills', 'total_ttc', 'guests_nb', 'guests_average',
                'guests_total_ttc', 'bar_nb', 'bar_average', 'bar_total_ttc']:
        data['last_%s' % key] = "%.2f" % MonthlyStat().get_value(key, last_year, month)
        data['max_%s' % key] = MonthlyStat().get_max(key)
        data['avg_%s' % key] = MonthlyStat().get_avg(key)
    return render_to_response('base/manager/rapports/home.html',
                                data,
                                context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:31,代码来源:__init__.py


示例14: users_change_perm

def users_change_perm(request, user_id, codename):
    data = get_user(request)
    user = get_object_or_404(User, pk=user_id)
    # little test because because user can do ugly things :)
    # now we are sure that it is a good permission
    if codename in settings.PERMS:
        perm = Permission.objects.get(codename=codename)
        if perm in user.user_permissions.all():
            if codename == 'p1' and perm.user_set.count() == 1:
                # we must have at least one person with this permission
                logger.info("[%s] user [%s] perm [%s]: at least should have "
                            "one person" % (data['user'].username,
                                            user.username, 
                                            codename))
                messages.add_message(request, messages.ERROR,
                                     "Il doit rester au moins 1 compte avec "
                                     "la permission P1.")
            else:
                user.user_permissions.remove(perm)
                logger.info("[%s] user [%s] remove perm: %s" % (
                            data['user'].username,
                            user.username,
                            codename))
        else:
            user.user_permissions.add(perm)
            logger.info("[%s] user [%s] add perm: %s" % (
                        data['user'].username,
                        user.username,
                        codename))
    else:
        logger.warning("[%s] wrong perm info : [%s]" % (data['user'].username,
                                                        codename))
    return HttpResponseRedirect('/manager/users/')
开发者ID:shenyk,项目名称:possum,代码行数:33,代码来源:__init__.py


示例15: rapports_daily

def rapports_daily(request):
    """
    Affiche le rapport pour une journée
    """
    data = get_user(request)
    data['menu_manager'] = True
    DailyStat().update()
    date = datetime.datetime.now()
    if request.method == 'POST':
        try:
            year = int(request.POST.get('date_year'))
            month = int(request.POST.get('date_month'))
            day = int(request.POST.get('date_day'))
            date = datetime.datetime(year, month, day)
        except:
            messages.add_message(request,
                                 messages.ERROR,
                                 "La date saisie n'est pas valide.")
    data['date_form'] = DateForm({'date': date, })
    data['date'] = date
    data = DailyStat().get_data(data, date)
    # les stats de l'année précédente
    last_year = get_last_year(date)
    for key in ['nb_bills', 'total_ttc', 'guests_nb', 'guests_average',
                'guests_total_ttc', 'bar_nb', 'bar_average', 'bar_total_ttc']:
        data['last_%s' % key] = "%.2f" % DailyStat().get_value(key, last_year)
        data['max_%s' % key] = DailyStat().get_max(key)
        data['avg_%s' % key] = DailyStat().get_avg(key)
    return render_to_response('base/manager/rapports/home.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:30,代码来源:__init__.py


示例16: sold_cooking

def sold_cooking(request, bill_id, sold_id, cooking_id=-1, menu_id=-1):
    data = get_user(request)
    data['sold'] = get_object_or_404(ProduitVendu, pk=sold_id)
    data['cookings'] = Cuisson.objects.order_by('priorite', 'nom')
    data['bill_id'] = bill_id
    if menu_id > -1:
        data['menu_id'] = menu_id
    if cooking_id > -1:
        cooking = get_object_or_404(Cuisson, pk=cooking_id)
        old = data['sold'].cuisson
        data['sold'].cuisson = cooking
        data['sold'].save()
        logger.debug("[S%s] cooking saved" % sold_id)
        if menu_id > -1:
            # this is a menu
            logger.debug("[S%s] is a subproduct of %s" % (sold_id, menu_id))
            menu = get_object_or_404(ProduitVendu, pk=menu_id)
            category = menu.getFreeCategorie()
            if category:
                logger.debug("[S%s] menu is not full" % menu_id)
                url = '/bill/%s/sold/%s/category/%s/select/' % (bill_id,
                      menu.id, category.id)
                return HttpResponseRedirect(url)
            else:
                logger.debug("[S%s] menu is full" % menu_id)
        if old == None:
            # certainement un nouveau produit donc on veut retourner
            # sur le panneau de saisie des produits
            return HttpResponseRedirect('/bill/%s/category/%s/' % (bill_id,
                                        data['sold'].produit.categorie.id))
        else:
            return HttpResponseRedirect('/bill/%s/' % bill_id)
    return render_to_response('base/bill/cooking.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:34,代码来源:bill.py


示例17: product_select_made_with

def product_select_made_with(request, bill_id, product_id):
    data = get_user(request)
    data['menu_bills'] = True
    data['bill'] = get_object_or_404(Facture, pk=bill_id)
    data['product'] = get_object_or_404(ProduitVendu, pk=product_id)
    data['categories'] = Categorie.objects.filter(made_in_kitchen=True)
    return render_to_response('base/bill/product_select_made_with.html',
                              data, context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:8,代码来源:bill.py


示例18: table_select

def table_select(request, bill_id):
    """Select/modify table of a bill"""
    data = get_user(request)
    data['menu_bills'] = True
    data['zones'] = Zone.objects.all()
    data['bill_id'] = bill_id
    return render_to_response('base/bill/select_a_table.html', data,
                              context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:8,代码来源:bill.py


示例19: bill_payment_view

def bill_payment_view(request, bill_id, payment_id):
    data = get_user(request)
    data['menu_bills'] = True
    data['bill_id'] = bill_id
    data['payment'] = get_object_or_404(Paiement, pk=payment_id)
    return render_to_response('base/bill/payment_view.html',
                                data,
                                context_instance=RequestContext(request))
开发者ID:shenyk,项目名称:possum,代码行数:8,代码来源:bill_payment.py


示例20: bill_payment_delete

def bill_payment_delete(request, bill_id, payment_id):
    data = get_user(request)
    data['menu_bills'] = True
    data['bill_id'] = bill_id
    payment = get_object_or_404(Paiement, pk=payment_id)
    bill = get_object_or_404(Facture, pk=bill_id)
    bill.del_payment(payment)
    return HttpResponseRedirect('/bill/%s/' % bill_id)
开发者ID:shenyk,项目名称:possum,代码行数:8,代码来源:bill_payment.py



注:本文中的possum.base.views.get_user函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python post.Post类代码示例发布时间:2022-05-25
下一篇:
Python posixpath.urljoin函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap