

@administrator_required
def update(request, category_id):
    category = get_object_or_404(Category, pk=category_id)
    if (request.method == 'POST'):
        form = CategoryForm(data=request.POST, instance=category)
        if form.is_valid():
            form.save()
            messages.info(request, _('The category has been updated!'))
            return redirect(reverse('spirit:admin:category:index'))
    else:
        form = CategoryForm(instance=category)
    context = {
        'form': form,
    }
    return render(category_id, 'spirit/category/admin/update.html', context)

dataset/ETHPy150Open nitely/Spirit/spirit/category/admin/views.py update/VarMisuse@118/159 `request`->`category_id`