Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to show texts on views

Hi,

i'm trying put some texts and forms in a view on Openstack Horizon Dashboard, so , i was trying do it using the method rende_to_response from django.shortcuts on python code and this doesn't work.

my code is this.

from django import http
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.shortcuts import render_to_response

class IndexView(TemplateView):
    template_name = 'visualizations/validar/index.html'

    def index(self):
        text = "it's a little text to do a test"
        return self.render_to_response('visualizations/validar/index.html', 'text':text})

and in my template like this

{% block main %}
 <h3> The text is : {{ text }}</h3>
{% endblock %}

It's a simple code, just to test this method.

click to hide/show revision 2
retagged

How to show texts on views

Hi,

i'm trying put some texts and forms in a view on Openstack Horizon Dashboard, so , i was trying do it using the method rende_to_response from django.shortcuts on python code and this doesn't work.

my code is this.

from django import http
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.shortcuts import render_to_response

class IndexView(TemplateView):
    template_name = 'visualizations/validar/index.html'

    def index(self):
        text = "it's a little text to do a test"
        return self.render_to_response('visualizations/validar/index.html', 'text':text})

and in my template like this

{% block main %}
 <h3> The text is : {{ text }}</h3>
{% endblock %}

It's a simple code, just to test this method.

How to show texts on views

Hi,

i'm trying put some texts and forms in a view on Openstack Horizon Dashboard, so , i was trying do it using the method rende_to_response from django.shortcuts on python code and this doesn't work.

my code is this.

from django import http
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.shortcuts import render_to_response

class IndexView(TemplateView):
    template_name = 'visualizations/validar/index.html'

    def index(self):
        text = "it's a little text to do a test"
        return self.render_to_response('visualizations/validar/index.html', 'text':text})

and in my template like this

{% block main %}
 <h3> The text is : {{ text }}</h3>
{% endblock %}

It's a simple code, just to test this method.

How to show texts on views

Hi,

i'm trying put some texts and forms in a view on Openstack Horizon Dashboard, so , i was trying do it using the method rende_to_response from django.shortcuts on python code and this doesn't work. the view don't show nothing .

my code is this.

from django import http
from django.utils.translation import ugettext_lazy as _
from django.views.generic import TemplateView
from django.shortcuts import render_to_response

class IndexView(TemplateView):
    template_name = 'visualizations/validar/index.html'

    def index(self):
        text = "it's a little text to do a test"
        return self.render_to_response('visualizations/validar/index.html', 'text':text})

and in my template like this

{% block main %}
 <h3> The text is : {{ text }}</h3>
{% endblock %}

It's a simple code, just to test this method.

and my urls.py file like this

from django.conf.urls.defaults import patterns, url
from .views import IndexView

urlpatterns = patterns('',
    url(r'^$', IndexView.as_view(), name='index')
)