Re: Display images in template using ManyToMany

2009-12-20 Thread Osiaq
Thank you :) That was the only thing I didn't try :)
It works flawlessly :)

On Dec 20, 8:39 pm, rebus_  wrote:
> {% for a in p.gallery.all %}
>         <--- TRY THIS
> {% endfor %}
>
> http://docs.djangoproject.com/en/dev/ref/files/file/#django.core.file...

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Re: Display images in template using ManyToMany

2009-12-20 Thread rebus_
{% for a in p.gallery.all %}
<--- TRY THIS
{% endfor %}

http://docs.djangoproject.com/en/dev/ref/files/file/#django.core.files.File.url

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.




Display images in template using ManyToMany

2009-12-20 Thread Osiaq
MODEL:
class PropertyGallery(models.Model):
link = models.ImageField(upload_to="gallery/props/")

class Property(models.Model):
name = models.CharField(max_length=200)
gallery=models.ManyToManyField(PropertyGallery)
--
TEMPLATE:
 Name: {{p.name}} 
{% for a in p.gallery.all %}
  <--- HERE IM LOST
{% endfor %}
--
VIEW:
def detail(request, object_id):
p = get_object_or_404(Property, pk=object_id)
return render_to_response('website/detail.html', {'p': p})


Iteration is working, but whatever I'm trying , always 

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.