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/')
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')
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')
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')
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/')