Hi all
i have there a little problem and my knowhow with django is not existent. ^^
What i have...
--------------- urls.py -----------------
from django.conf.urls import patterns, include, url
from klasse.views import portal, sql
urlpatterns = patterns('',
(r'^portal/$', portal),
(r'^sql/$', sql),
)
-----------------------------------------
------------ views.py ----------------
from django.shortcuts import render_to_response
import datetime
def portal(request):
now = datetime.datetime.now()
return render_to_response('portal.html', {'current_date': now})
def sql(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 = '***')")
row = cursor.fetchall()
return HttpResponse(row)
---------------------------------------
The Settings are correct... The output of sql works
------------------------------------- portal.html --------------------------------
{% extends "base.html" %}
{% block title %}Kundendaten{% endblock %}
{% block content %}<p>Zeit der Aktualisierung {{ current_date }}.</p>{% endblock %}
-------------------------------------------------------------------------------------
------------------------------- base.html ---------------------------------------
{% include "header.html" %}
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<h1>Portal</h1>
<h2>Ausgabe Kundendaten</h2>
{% block content %}{% endblock %}
{% include "footer.html" %}
-------------------------------------------------------------------------------------
how can i implements now these "def sql(request):" into my html code? pls help me...