django-context refers to the special django.template.Context class used for passing data from the view to the template
Questions tagged [django-context]
171 questions
0
votes
1 answer
Django web interface to store queries and define context
I'm open to persuasion that this is a bad idea. But if not, here's the general draw:
Web interface to maintain data (django.contrib.admin).
Web interface to create pages (django.contrib.flatpages)
Web interface to create templates…

Daniel Rhoden
- 6,117
- 6
- 26
- 28
0
votes
1 answer
How do I use a complex context with Django?
I'm learning Django by building simple contact manager,
I use Django 1.7.3 with Python 2.7.
I'm confused about how to render the template with the given context.
context = {
'name': 'John Doe',
'age': 24,
'email_ids' : [
{
…

Martin Joe
- 27
- 9
0
votes
3 answers
Is content from AJAX call added to Django context variable
I am using the JQuery load function to load part of my page. Can I access the variables from that page in the page that loads it. e.g.
Page A uses JQuery load function to load B
Page B loads and sets a variable in context called pageB_var which…

John
- 21,047
- 43
- 114
- 155
0
votes
1 answer
Default RequestContext in Django
I have such a function(view)
def index(request):
return render_to_response('index.html', context_instance=RequestContext(request))
and want to write just
return render_to_response('index.html')
Also I want to pass additional variables to…

Most Wanted
- 6,254
- 5
- 53
- 70
0
votes
1 answer
django form_data filter template
I have 4 class models, and i have done a WizardView.
In the end of the view, I have
return render_to_response('fattura_wizard.html', {
'form_data': [form.cleaned_data for form in form_list],
})
I need to use the single fields in the HTML…

Pimuzzo
- 103
- 1
- 9
0
votes
1 answer
My Django views and URLs aren't matching up somewhere giving me a blank screen
I'm new to Python and Django, I've been through the tutorial that builds a blog, I've been through another tutorial that builds an page based on beers and breweries.
While going through this I started my own project while following along. 1st page…

user3255253
- 5
- 2
0
votes
1 answer
Django Form Wizard: Access to context in forms
I have a Django 1.6 form wizard that contains 5 forms. I want each of the forms to have access to the values of the fields in all previous forms.
I have defined a get_context_data method in views.py and it seems to do what it should. Here is my…

Reino Wallin
- 1
- 1
- 2
0
votes
1 answer
Django render DecimalFields
My code, models.py
class accounts(models.Model):
paid = models.DecimalField(max_digits=8, decimal_places=2, default=0)
balance = models.DecimalField(max_digits=8, decimal_places=2, default=0)
Views.py
def home(request):
template =…
user3854113
0
votes
1 answer
Django filter field on the context processor
I want to filter a result of a field in django in an html file.
Something like this
{{ model.field where id = 2 }}
I've been looking for in django docs but i only could find a way to do it on the views.py.
I also so something like javascript when u…
user3854113
0
votes
1 answer
Django template tag exception
It looks like this template tag works like a charm for most people:
http://blog.localkinegrinds.com/2007/09/06/digg-style-pagination-in-django/
For some reason I get this error: Caught an exception while rendering: 'is_paginated'
I use this template…

ninja123
- 1,069
- 1
- 13
- 21
0
votes
0 answers
Form instantiation mechanism
I have a problem with Django form instantiation. To sum up, here's my code. In a view, I have to generate a context which is related to many objects.
def my_view(request):
myObjects = ObjectFromModels.objects.filter(some_attribute = '1234')
…

Kobz
- 469
- 6
- 17
0
votes
1 answer
Django context processors appear not to be running in non-debug mode
I'm using the django_browserid app. Here is part of my settings file.
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS as TCP
TEMPLATE_CONTEXT_PROCESSORS = TCP + (
"django.core.context_processors.request",
…

Joe
- 46,419
- 33
- 155
- 245
0
votes
1 answer
Why is Django missing the custom context processor?
My django 1.6 project is structured:
cg1
cg1
settings.py
cont_proc.py
inti, etc.
app
app
manage.py
templates
cont_proc.py reads:
from django.conf import settings
def misc(request):
return {'SITE_URL':…

arthur.00
- 175
- 1
- 6
0
votes
2 answers
Django: Setting context by url's GET
How can you make a specific action based on the url by base.html?
I have two if -clauses as context statements in base.html. If there is algebra in the GET, then the given context should be shown.
My url.conf
from django.conf.urls.defaults import…
anon
0
votes
1 answer
How to get django context automatically in Jinja2 filters?
For example, I have an paginator object with a lot of attributes, and don't want do write something like {{ paginate(paginator) }} in templates.
How can a get context automatically in the filter function, like a django register.inclusion_tag(…,…

SvartalF
- 163
- 2
- 8