Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
views on one page
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nebros  
View profile  
 More options Nov 14 2012, 4:50 am
From: Nebros <markuschriste...@gmail.com>
Date: Wed, 14 Nov 2012 01:50:04 -0800 (PST)
Local: Wed, Nov 14 2012 4:50 am
Subject: views on one page

Good morning
I have 2 diffrent views, every one i just needet on one page... till now.

view one-----output is the time-----------------
@csrf_protect
def portal(request):
    now = datetime.datetime.now()
    return render_to_response('portal.html', {'current_date': now},
context_instance=RequestContext(request))
---------------------------------------------------------

view two-----output are data out of a mssql db--------------
def kundendaten(request):
    cnxn = pyodbc.connect('DRIVER={SQL
Server};SERVER=MAURITIUS;DATABASE=baan5c;UID=***;PWD=*****')
    cursor = cnxn.cursor()
    cursor.execute("SELECT x.t_name, y.t_mail FROM tttaad200000 as x,
tttcmf200000 as y WHERE (x.t_name = y.t_name) AND (x.t_user = 'niedereh')")
    row = cursor.fetchall()
    return render_to_response("kundendaten.html", { 'row': row },
context_instance=RequestContext(request))
---------------------------------------------------------------------------

in addition, i have to set the x.t_user as a variable. the value will be
given from the page before. (form/post/submit)

how can i use this two now on one page? (i know these are two
render_to_response and i cant just use:
{% block content %}<p>Zeit der Aktualisierung {{ current_date }}</p>{%
endblock %}
and
{% block content %}<p>Kundendaten {{ row }}.</p>{% endblock %}
on one page)...

I just failed by the try to change them...


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Martin J. Laubach  
View profile  
 More options Nov 14 2012, 5:00 am
From: "Martin J. Laubach" <goo...@emsi.priv.at>
Date: Wed, 14 Nov 2012 02:00:18 -0800 (PST)
Local: Wed, Nov 14 2012 5:00 am
Subject: Re: views on one page

Do you actually need both as views proper? The easiest thing would be to
factor out the fetching part of the kundendaten view, make that return just
a dictionary, then call that and update the context in the first view.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nebros  
View profile  
 More options Nov 14 2012, 5:38 am
From: Nebros <markuschriste...@gmail.com>
Date: Wed, 14 Nov 2012 02:38:26 -0800 (PST)
Local: Wed, Nov 14 2012 5:38 am
Subject: Re: views on one page

I need both together, because later i need another output from another
database (lotus notes (i hate it)) on the same page. Can you make a code
for me? im really not good (a new user)... when one part works, maybe i
know than how to implements the next database by myself. :)

Am Mittwoch, 14. November 2012 11:00:18 UTC+1 schrieb Martin J. Laubach:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nebros  
View profile  
 More options Nov 15 2012, 4:03 am
From: Nebros <markuschriste...@gmail.com>
Date: Thu, 15 Nov 2012 01:03:31 -0800 (PST)
Local: Thurs, Nov 15 2012 4:03 am
Subject: Re: views on one page

Are there not more intput? pls help me, I do not go any further...!

Am Mittwoch, 14. November 2012 10:50:04 UTC+1 schrieb Nebros:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Vibhu Rishi  
View profile  
 More options Nov 15 2012, 10:14 pm
From: Vibhu Rishi <vibhu.ri...@gmail.com>
Date: Fri, 16 Nov 2012 08:43:14 +0530
Local: Thurs, Nov 15 2012 10:13 pm
Subject: Re: views on one page

I don't think you can use 2 views on the same page.

what you can do is pass 2 values to the same page to display.

so in the 2nd view you will do as follows:
return render_to_response("kundendaten.html", { 'row': row,'current_date':
now }, context_instance=RequestContext(request))

and make sure that you have a variable for now in the 2nd view.

Hope this helps.

V.

--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nebros  
View profile  
 More options Nov 16 2012, 3:08 am
From: Nebros <markuschriste...@gmail.com>
Date: Fri, 16 Nov 2012 00:08:33 -0800 (PST)
Local: Fri, Nov 16 2012 3:08 am
Subject: Re: views on one page

That was exactly what i have searched for. thank you very mutch. it works
now. i post here again my current code, if another needs the same help...

views---------------------------------------------
def kundendaten(request):
    cnxn = pyodbc.connect('DRIVER={SQL
Server};SERVER=MAURITIUS;DATABASE=baan5c;UID=***;PWD=*****')
    cursor = cnxn.cursor()
    cursor.execute("SELECT x.t_name, y.t_mail FROM tttaad200000 as x,
tttcmf200000 as y WHERE (x.t_name = y.t_name) AND (x.t_user = 'niedereh')")
    row = cursor.fetchall()
    now = datetime.datetime.now()
    return render_to_response("kundendaten.html", { 'row':
row,'current_date': now }, context_instance=RequestContext(request))
----------------------------------------------------

and here a part of my kundendaten.html
kundendaten----------------------------------
<h2>Ausgabe Kundendaten</h2>
{% block content1 %}<p>Zeit der Aktualisierung {{ current_date }}</p>{%
endblock %}
{% block content2 %}<p>Kundendaten {{ row }}.</p>{% endblock %}
----------------------------------------------------

have a nice day! :)

Am Freitag, 16. November 2012 04:14:17 UTC+1 schrieb Vibhu Rishi:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »