예제 #1
0
파일: views.py 프로젝트: fccgp/possum
def categories_new(request):
    data = get_user(request)
    priority = request.POST.get('priority', '').strip()
    name = request.POST.get('name', '').strip()
    if name:
        cat = Categorie()
        cat.nom = name
        if priority:
            cat.priorite = priority
        try:
            cat.save()
            logging.info("[%s] new categorie [%s]" % (data['user'].username, name))
        except:
            logging.warning("[%s] new categorie failed: [%s] [%s]" % (data['user'].username, cat.priorite, cat.nom))
            messages.add_message(request, messages.ERROR, "La nouvelle catégorie n'a pu être créée.")
    else:
        messages.add_message(request, messages.ERROR, "Vous devez choisir un nom pour la nouvelle catégorie.")
    return HttpResponseRedirect('/carte/categories/')
예제 #2
0
파일: __init__.py 프로젝트: anoopl/possum
def categories_new(request):
    priority = request.POST.get('priority', '').strip()
    name = request.POST.get('name', '').strip()
    if name:
        cat = Categorie()
        cat.nom = name
        if priority:
            cat.priorite = priority
        try:
            cat.save()
            logger.info("[%s] new categorie [%s]" % (request.user.username,
                                                     name))
        except:
            logger.warning("[%s] new categorie failed: [%s] [%s]" % (
                           request.user.username, cat.priorite, cat.nom))
            messages.add_message(request, messages.ERROR, "La nouvelle "
                                 "catégorie n'a pu être créée.")
    else:
        messages.add_message(request, messages.ERROR, "Vous devez choisir "
                             "un nom pour la nouvelle catégorie.")
    return redirect('categories')
예제 #3
0
def categories_new(request):
    priority = request.POST.get('priority', '').strip()
    name = request.POST.get('name', '').strip()
    if name:
        cat = Categorie()
        cat.nom = name
        if priority:
            cat.priorite = priority
        try:
            cat.save()
            logger.info("[%s] new categorie [%s]" %
                        (request.user.username, name))
        except:
            logger.warning("[%s] new categorie failed: [%s] [%s]" %
                           (request.user.username, cat.priorite, cat.nom))
            messages.add_message(request, messages.ERROR,
                                 _("New category has not been created"))
    else:
        messages.add_message(request, messages.ERROR,
                             _("You must choose a name for the new category"))
    return redirect('categories')
예제 #4
0
파일: __init__.py 프로젝트: 2br0ne/possum
def categories_new(request):
    priority = request.POST.get('priority', '').strip()
    name = request.POST.get('name', '').strip()
    if name:
        cat = Categorie()
        cat.nom = name
        if priority:
            cat.priorite = priority
        try:
            cat.save()
            logger.info("[%s] new categorie [%s]" % (request.user.username,
                                                     name))
        except:
            logger.warning("[%s] new categorie failed: [%s] [%s]" % (
                           request.user.username, cat.priorite, cat.nom))
            messages.add_message(request, messages.ERROR,
                                 _("New category has not been created"))
    else:
        messages.add_message(request, messages.ERROR,
                             _("You must choose a name for the new category"))
    return redirect('categories')
예제 #5
0
파일: views.py 프로젝트: taigum/possum
def categories_new(request):
    data = get_user(request)
    priority = request.POST.get('priority', '').strip()
    name = request.POST.get('name', '').strip()
    if name:
        cat = Categorie()
        cat.nom = name
        if priority:
            cat.priorite = priority
        try:
            cat.save()
            logging.info("[%s] new categorie [%s]" %
                         (data['user'].username, name))
        except:
            logging.warning("[%s] new categorie failed: [%s] [%s]" %
                            (data['user'].username, cat.priorite, cat.nom))
            messages.add_message(request, messages.ERROR,
                                 "La nouvelle catégorie n'a pu être créée.")
    else:
        messages.add_message(
            request, messages.ERROR,
            "Vous devez choisir un nom pour la nouvelle catégorie.")
    return HttpResponseRedirect('/carte/categories/')