@login_required<EOL>def product_category(request, category_id):
PRODUCTS_FORM_PREFIX = "<STR_LIT>"<EOL>VOUCHERS_FORM_PREFIX = "<STR_LIT>"<EOL>v = _handle_voucher(request, VOUCHERS_FORM_PREFIX)<EOL>voucher_form, voucher_handled = v<EOL>category_id = int(category_id)  <EOL>category = inventory.Category.objects.get(pk=category_id)<EOL>with BatchController.batch(request.user):<EOL><INDENT>products = ProductController.available_products(<EOL>request.user,<EOL>category=category,<EOL>)<EOL>if not products:<EOL><INDENT>messages.warning(<EOL>request,<EOL>(<EOL>"<STR_LIT>" +<EOL>category.name<EOL>),<EOL>)<EOL>return redirect("<STR_LIT>")<EOL><DEDENT>p = _handle_products(request, category, products, PRODUCTS_FORM_PREFIX)<EOL>products_form, discounts, products_handled = p<EOL><DEDENT>if request.POST and not voucher_handled and not products_form.errors:<EOL><INDENT>if products_form.has_changed():<EOL><INDENT>messages.success(<EOL>request,<EOL>"<STR_LIT>",<EOL>)<EOL><DEDENT>return redirect(review)<EOL><DEDENT>data = {<EOL>"<STR_LIT>": category,<EOL>"<STR_LIT>": discounts,<EOL>"<STR_LIT>": products_form,<EOL>"<STR_LIT>": voucher_form,<EOL>}<EOL>return render(request, "<STR_LIT>", data)<EOL>
Form for selecting products from an individual product category.

    Arguments:
        category_id (castable to int): The id of the category to display.

    Returns:
        redirect or render:
            If the form has been sucessfully submitted, redirect to
            ``dashboard``. Otherwise, render
            ``registrasion/product_category.html`` with data::

                {
                    "category": category,         # An inventory.Category for
                                                  # category_id
                    "discounts": discounts,       # A list of
                                                  # DiscountAndQuantity
                    "form": products_form,        # A form for selecting
                                                  # products
                    "voucher_form": voucher_form, # A form for entering a
                                                  # voucher code
                }