Hi group,

I have the following problem:

***** a relation in the model between posts and images *****
class Post(models.Model):
    imagepost       = models.ManyToManyField(Image, blank=True,
verbose_name=_('media'))

***** usage of media in view *****
def post(request, username, year, month, slug, item, blog__id,
         template_name="blog/post.html"):
    post = Post.objects.filter(slug=slug, item=item, publish__year=int
(year), publish__month=int(month))

    media = Post.objects.get(slug=slug)
    media = media.imagepost.all()

***** rendering in template *****
{{ media }}


Though this method doesn't work for a list (by using for a in b)
because multiple returns. The orinary {{ post.imagepost }} in the
template returns <django.db.models.fields.related.ManyRelatedManager
object at 0x989410c> because the variety of possible combinations.

What is a good way to work around this in a list?

Thanks

-- 
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.


Reply via email to