user = request.user return render_to_response("datarequests/view_datarequest.html", { # This required that view_datarequest MUST NOT pass # in any template arguments but datarequest, user # and postcommentform. "datarequest": datarequest, "form": form, }, context_instance=RequestContext(request)) # This required that view_datarequest MUST NOT pass in any template arguments but # datarequest, user and postcommentform. post_datarequest_comment = make_comment_view( DataRequest, "epic.datarequests.views.view_datarequest", "datarequests/view_datarequest.html", "datarequest") @login_required def new_datarequest(request): user = request.user if request.method != 'POST': #New form needed form = DataRequestForm() else: form = DataRequestForm(request.POST) if form.is_valid(): # The request instance from from.save() would not have an creator since we don't let the user set this # It is therefore necessary that we do not commit and handle setting the creator here. datarequest = form.save(commit=False)
return render_to_response('datasets/view_datasets.html', {'datasets': datasets, 'user': request.user}, context_instance=RequestContext(request)) def view_dataset(request, item_id=None, slug=None): dataset = get_object_or_404(DataSet, pk=item_id) post_comment_form = PostCommentForm() user = request.user return render_to_response('datasets/view_dataset.html', {'dataset': dataset, 'user': user, 'post_comment_form': post_comment_form}, context_instance=RequestContext(request)) post_dataset_comment = make_comment_view( DataSet, "epic.datasets.views.view_dataset", "datasets/view_dataset.html", "dataset") def view_user_dataset_list(request, user_id=None): requested_user = get_object_or_404(User, pk=user_id) datasets = DataSet.objects.filter(creator=user_id).order_by('-created_at') return render_to_response('datasets/view_user_dataset_list.html', {'datasets': datasets, 'user': request.user, 'requested_user':requested_user}, context_instance=RequestContext(request)) @login_required def create_dataset(request): if request.method != 'POST':
return render_to_response('datasets/view_datasets.html', {'datasets': datasets,}, context_instance=RequestContext(request)) def view_dataset(request, item_id=None, slug=None): dataset = get_object_or_404(DataSet, pk=item_id) form = PostCommentForm() user = request.user return render_to_response('datasets/view_dataset.html', {'dataset': dataset, 'form': form}, context_instance=RequestContext(request)) post_dataset_comment = make_comment_view( DataSet, 'epic.datasets.views.view_dataset', 'datasets/view_dataset.html', 'dataset') def view_user_dataset_list(request, user_id=None): requested_user = get_object_or_404(User, pk=user_id) datasets = DataSet.objects.filter(creator=user_id).order_by('-created_at') return render_to_response('datasets/view_user_dataset_list.html', {'datasets': datasets, 'requested_user':requested_user,}, context_instance=RequestContext(request)) @login_required def create_dataset(request): if request.method != 'POST':