ScotchAndSoda
ScotchAndSoda

Reputation: 4171

Django render template in a pop-up

As a beginer with javascript, I am looking for a manner to render a template from django in a javascript popup. Thanks.

Upvotes: 8

Views: 19041

Answers (1)

Mohammad Efazati
Mohammad Efazati

Reputation: 4910

create view and django template and in django template create link to new page

<script language="javascript" type="text/javascript">
<!--
function popitup(url) {
    newwindow=window.open(url,'{{title}}','height=200,width=150');
    if (window.focus) {newwindow.focus()}
    return false;
}

// -->
</script>

<a href="popupex.html" onclick="return popitup('/example/popup')"
    >{% trans 'Link to popup' %}</a>

so you must have another app with '/example/popup' url

ps: there are many other way ... its only one suggestion!

Upvotes: 11

Related Questions