Questions tagged [requestcontext]
93 questions
26
votes
14 answers
CSRF verification failed. Request aborted
I try to build a very simple website where one can add data into sqlite3 database. I have a POST form with two text input.
index.html:
{% if top_list %}
Name Total steps{% for t in top_list %} …

Bebe
- 347
- 1
- 5
- 10
21
votes
2 answers
How do I Access the RequestContext Outside the Controller?
Background
I am trying to move business logic out from the controllers into their own services.
Controller
public class AccountController : Controller
{
private readonly IAccountService _accountService;
public…

nfplee
- 7,643
- 12
- 63
- 124
17
votes
1 answer
How to access RequestContext in class-based generic views?
I have this path in my urls.py:
archive_index_dict = {
'queryset': News.objects.filter(show=True),
'date_field': 'date',
'template_object_name': 'object_list',
}
...
url(r'^$', 'django.views.generic.date_based.archive_index',
…

Vlad T.
- 2,568
- 3
- 26
- 40
8
votes
2 answers
How to resolve "Could not find a declaration file for module 'request-context'. "?
I am working on three files at the moment which are index.js , index.main.js and app.js. I'm using request-context to grab a variable from index.main.js and pass it to index.js.
In app.js (A file I created in my server folder) I have the following…

Vaulient
- 335
- 1
- 4
- 14
7
votes
5 answers
Can I access virtual directory name in global.asax.cs?
The property HttpContext.Current.Request.ApplicationPath represents the virtual directory in IIS or WebDev.WebServer.
HttpContext.Current.Request.ApplicationPath evaluates to "/virtualdirectory"
This can be used in conjunction with…

Simon_Weaver
- 140,023
- 84
- 646
- 689
6
votes
1 answer
How to send a POJO as a callback param using PrimeFaces' RequestContext?
I can send callback param(s) and it works perfectly as long as I am only sending some primitive types like String. But the same thing does not work for even the simplest POJO. PrimeFaces guide says that the RequestContext.addCallbackParam() method…

Bhesh Gurung
- 50,430
- 22
- 93
- 142
6
votes
3 answers
Primefaces: RequestContext.execute - Javascript called twice
I'm using primefaces and have a problem executing JavaScript at the end of an ajax call. I add some action to the RequestContext, and it is executed twice!
RequestContext.getCurrentInstance().execute("alert('I'm here!')");
It is also embedded…

anm
- 545
- 3
- 17
5
votes
1 answer
Can I set a default field value of an EntityProxy?
Say I have this:
TimeEntryProxy timeEntry = someRequestContext.create(TimeEntryProxy.class);
The created proxy is empty. Is there a way to set some of it's fields with a default value? For example, this proxy has a timeAllocation which is a double.…

code-gijoe
- 6,949
- 14
- 67
- 103
5
votes
1 answer
Clarify how GWT RequestFactory and RequestContext work
I am trying to implement RequestFactory and the Editor framework into my app. I'm finding even after researching the forum, the Google Developer forum, and others that there is something fundamental that I don't understand about using RequestContext…

mcfar
- 137
- 2
- 10
5
votes
3 answers
Why on earth do I have to pass RequestContext in all of my responses?
I want to highlight the current page in the navigation menu. Obviously I need to give the menu links a class like 'active' when you are on their page. This is a classic problem and I've seen many solutions proposed. My problem is I hate all of them…

Jimmy
- 639
- 1
- 5
- 9
4
votes
1 answer
ASP.NET MVC Injecting Http/Request/Controller context
Is there a recommended approach for injecting Http/Request/Controller context in an ASP.NET MVC application?
Previously I've only done this with HttpContext like so (I'm using StructureMap):
For().Use(ctx => new…

Ben Foster
- 34,340
- 40
- 176
- 285
4
votes
3 answers
Django 1.11 context processor error: TypeError: context must be a dict rather than RequestContext'
I cannot figure out why I'm encountering a problem with Django 1.11 and RenderContext. I really need help here. This is the code I've been playing with from the official documentation for 1.11:
from django.http import HttpResponse
from…

user1601871
- 91
- 1
- 6
4
votes
2 answers
Is there a way to get direct_to_template to pass RequestContext in django?
I have found myself writing the same view over and over. It is basically this:
def home_index(request):
return render_to_response('home/index.html', RequestContext(request))
To keep with the dry principal, I would like to utilize a generic…

Jason Webb
- 7,938
- 9
- 40
- 49
4
votes
2 answers
pass multiple objects to RequestContext in django
I need to pass a dict and an object to a template. So, I do this
rc = RequestContext(request, {'prob':prob}, {'result':result})
return render_to_response('subject/question.html', context_instance=rc)
But I get a error.
Traceback: File…

John Eipe
- 10,922
- 24
- 72
- 114
3
votes
1 answer
Creating singletons in django, or any other way for global, per-request available object
While developing "widgets" (objects, which - rendered - use some custom javascript files), I faced the need of creating kind of "included-scripts-manager" (to avoid double inclusion of same JS file when more than one widget is rendered for the…

migajek
- 8,524
- 15
- 77
- 116