it's the first time i try using the model property so probably i'm doing 
something wrong.
This is the model file:

from django.db import models

# Create your models here.

class Pop(models.Model):
    name = models.CharField(max_length=10)
    content = models.TextField(blank=True, null=True)

    def __unicode__(self):
        return self.name

class Text(models.Model):
    pag = models.CharField(max_length=20)
    content = models.TextField(blank=True, null=True)
    popup = models.ManyToManyField(Pop, blank=True, null=True)

    def __unicode__(self):
        return self.pag

And this is the template:

<!doctype html> 
<html lang="it"> 
<head> 
  <meta charset="utf-8">
  <meta name="viewport" content="width=800">
  <link rel="icon" href="/static/img/standard.gif" sizes="16x16" 
type="image/gif"> 
  <link rel="icon" href="/static/img/iphone.png"   sizes="57x57" 
type="image/png"> 
  <link rel="icon" href="/static/img/vector.svg"   sizes="any"   
type="image/svg+xml">
  <link rel="stylesheet" href="http://joy.indivia.net/css/style.css";>
  <script type="text/javascript" 
src="http://joy.indivia.net/js/cookie.js";></script>
  <script type="text/javascript" 
src="http://joy.indivia.net/js/html5shiv.js";></script>
  <script type="text/javascript" 
src="http://joy.indivia.net/js/avgrund.js";></script>
  <script type="text/javascript" 
src="http://ajax.googleapis.com/ajax/libs/prototype/1.7/prototype.js";></script>
  
</head>
  <body> 
    <header>
<h1>MADE IN HUMAN</h1>
</header>
{% for t in text %}
         <article id="content" class="avgrund-contents"> {{ t.content|safe 
}}</article>
{% endfor %}
         <div class="avgrund-cover"></div>
{% if text.popup_set.all %}
{% for p in text.popup_set.all %}
 <script>
            var openDialog = function(){
                Avgrund.show( "{{p.name}}" );
            };
            function closeDialog() {
                Avgrund.hide();
            };
            document.observe('dom:loaded', function(){
                $('content').on('click', 'a', openDialog());
            };
        </script>
        <aside id="{{p.name}}" class="avgrund-popup">
                    {{ p.content|safe }}
                    <button 
onclick="javascript:closeDialog();">Close</button>
                </aside>
{% endfor %}{% endif %}
<footer>
        <dl>
        </dl>
    </footer>
</body> 
</html>


After the if statement probably nothing gets executed, so probably 
text.popup_set.all doesn't work, even if there are pops in the popup field 
of the text passed to the html file by a render to response call....
Someone that speaks django dialect better than me can explain me what i'm 
doing wrong?
Thanks


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/--4jsFw_WaIJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to