Hi, I am starting out with django and python, don't have much experience in either. I have managed to create a few "simple" website with django and really enjoy working with it.
But I am a bit stuck on my latest project. I am using a M2M relation via an intermediary table. http://dpaste.com/hold/7651/ I put all the code in there .. I have a Image model, a ImageGroup (intermediate table) model and a News (New) model. New(s) has a: imagecollection = models.ManyToManyField(ImageGroup...) and ImageGroup holds: Position (for sorting) and a ForgeignKey to Image Image holds: Caption and the path to the image file. I made a simple inclusion tag to get my News objects and send them to my template. But I am stuck on how do I get to the image data in my template? More specific for this example I only need the 1st image, later on I will need all related images but I hope I will understand how to do it once I get to that stage. I guess I need something in the inclusion_tag to get me the related images in the order of the intermediate table "position" field? I tried this but django complains about "self" (global name 'self' is not defined) images = ImageGroup.objects.filter( new = self.id ).order_by( 'position' )[:1] I read the docs and found examples in this group but I can't get my head around it how it works on my model layout. any help will be greatly appreciated. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---