Loading the content of an iframe

346 views
Skip to first unread message

Gary Roach

unread,
Nov 19, 2016, 5:01:38 PM11/19/16
to django-users
Hi all,

I am really stumbling around with my project at present. I am relatively
new to both Python and Django and have started a major project with both
(retired and have plenty of time).

I have set up a main.html page that has logos and such at the top of the
page and has some more logo stuff and copyright stuff at the bottom. I
have an iframe that fills the center of the page. There are several
control buttons at the top - but outside - of the iframe. I wish to be
able to push one of the control buttons and have the selected content
appear in the iframe. The pertinent code is:

Debian os, kde4 desktop, Django 1.9, Python 3.5, Postgresql 9.1

Project archive
urls.py
from django.conf.urls import url
from django.contrib import admin

from . import views

urlpatterns = [
url(r'^$', views.mainPage),
url(r'^welcome/', views.welcome),
url(r'^first/', views.readMeFirst),
url(r'^admin/', admin.site.urls),
]
views.py
from django.shortcuts import render


def mainPage(request):
return render(request, 'main/main.html')


def welcome(request):
return render(request, 'main/welcome.html')


def readMeFirst(request):
return render(request, 'main/readMeFirst.html')


main.html (parts)
switch(bn) {
case "b1":
jQuery.get("views.welcome");
break;
case "b2":
break;
case "b3":
break;
case "b4":
break;

and later

<div >
<iframe id="iframe1" src="" >

</iframe>
</div>


I have no idea how to tie all of this together. I'm probably way off
base and need advise. The object is to push buttons and have the
appropriate pages show up in the iframe. These pages may have active
elements withing them or may have data fetched from the database included.

Any help will be sincerely appreciated.

Gary R.




ludovic coues

unread,
Nov 21, 2016, 4:47:57 AM11/21/16
to django...@googlegroups.com
This is an HTML problem, not a django one.
You can try to set a property target="iframe1" on your link. Like that:

<a href="/welcome/" target="iframe1">welcome</a>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/339ff49b-358c-111c-cd40-05d90a5474ba%40verizon.net.
> For more options, visit https://groups.google.com/d/optout.



--

Cordialement, Coues Ludovic
+336 148 743 42
Reply all
Reply to author
Forward
0 new messages