def add_review(request, product_id=None):
    if request.method == "POST":
        form = ReviewForm(request.POST)
        if form.is_valid():
            data = form.cleaned_data
            user = request.user
            review = reviews.models.Review.objects.create(
                    author_id = user.is_authenticated() and user.id or -1,
                    product_id = data["product"],
                    rating = data["rating"],
                    text = data["review"]
            )
            return http.HttpResponseRedirect(reverse("show-review",
                    args=[review.id]))
    else:
        if product_id:
            initial = {"product": product_id}
        else:
            initial = None
        form = ReviewForm(initial=initial)
    data = {
            "form": form,
            "title": "Create new review",
            }
    return render_to_response("reviews/new_review.html", data,
            RequestContext(request))
Submit a review for a product.
dataset/ETHPy150Open malcolmt/django-multidb-patterns/sharding/reviews/views.py/add_review