Re: merge images into a webpage

2011-07-10 Thread het.oosten
> > Just so happens I'm learning Dutch at the moment, and was able to read a lot > of the code ;p I guess that was my luck :-) -- 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. T

Re: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 8:58 PM, het.oosten wrote: > Ye, I think this was the only option i didnt try :-) > > Thanks Cal and Shawn! > > In a previous i translated the Dutch into English, and mixed things > up, making everything more confusing. > Just so happens I'm learning Dutch at the mome

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Ye, I think this was the only option i didnt try :-) Thanks Cal and Shawn! In a previous i translated the Dutch into English, and mixed things up, making everything more confusing. Rob On Jul 10, 9:40 pm, "Cal Leeming [Simplicity Media Ltd]" wrote: > Nice, not often I come across code writ

Re: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
Nice, not often I come across code written in nederlands ;p Is this what you are looking for by any chance?? {{plaatje.1.plaatjes_lijst}} On Sun, Jul 10, 2011 at 8:33 PM, het.oosten wrote: > One addition to the above, when i do: >def __unicode__(self): > return '' % >

Re: merge images into a webpage

2011-07-10 Thread het.oosten
One addition to the above, when i do: def __unicode__(self): return '' % (self.plaatje, self.alt) I can call the single images in the template with {{plaatje.1}} etc I found out in this thread that it is not a good idea to "abuse" unicode for this On Jul 10, 9:28 pm, "het.

Re: merge images into a webpage

2011-07-10 Thread het.oosten
> have the variable image_list in your context which is a list, you can do > this: > > {{ image_list.0 }} and {{ image_list.1 }} This is what i tried, but the only way to show the images is(plaatjes_lijst=image_list): {% for x in plaatje %} {{x.plaatjes_lijst|safe}} {% endfor %} -- You received

Re: merge images into a webpage

2011-07-10 Thread Shawn Milochik
You can easily do this in your template with an index. Assuming you'll have the variable image_list in your context which is a list, you can do this: {{ image_list.0 }} and {{ image_list.1 }} -- You received this message because you are subscribed to the Google Groups "Django users" group. To

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Here is the link to pastebin: http://pastebin.com/1FuVH7Hu It is all about getting specific content for a season a user chooses (it is a site for a campground) If you need more info, i will be happy to provide. -- You received this message because you are subscribed to the Google Groups "Djang

Re: merge images into a webpage

2011-07-10 Thread Cal Leeming [Simplicity Media Ltd]
On Sun, Jul 10, 2011 at 6:26 PM, het.oosten wrote: > Ok perhaps a basic question. I wrote a custom method for my model: >def image_list(self): >return '' % > (self.image, self.alt) > You should never really put HTML inside a method unless you *really* have to (even if it'

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Ok perhaps a basic question. I wrote a custom method for my model: def image_list(self): return '' % (self.image, self.alt) And i indeed get a nice list of image in the template. I want however control where the single images show up. With something like {{image. 1}} other t

Re: merge images into a webpage

2011-07-10 Thread Shawn Milochik
On 07/10/2011 12:28 PM, het.oosten wrote: Adding a method/property to my model is a thing i haven't considered. You have a good point there. I will do some more reading to find a solution in this direction. Thanks! Rob It's easy to forget that Django is just Python. You're the programmer, so

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Adding a method/property to my model is a thing i haven't considered. You have a good point there. I will do some more reading to find a solution in this direction. Thanks! Rob On Jul 10, 5:54 pm, Shawn Milochik wrote: > I'd rather see the contents of your __unicode__ function as a > get_absolut

Re: merge images into a webpage

2011-07-10 Thread Shawn Milochik
I'd rather see the contents of your __unicode__ function as a get_absolute_url function, with the __unicode__ maybe returning just the filename or the parent object's title and the filename. I strongly dislike the embedding of template code in a text field of your model, because it makes maint

Re: merge images into a webpage

2011-07-10 Thread het.oosten
Oops i posted too fastis there a better way to accomplish the above? On Jul 10, 12:41 pm, "het.oosten" wrote: > I got is working like this: > > In my model: >         titel = models.CharField(max_length=200) >         alt = models.CharField(max_length=200) >         plaatje = models.ImageFiel

Re: merge images into a webpage

2011-07-10 Thread het.oosten
I got is working like this: In my model: titel = models.CharField(max_length=200) alt = models.CharField(max_length=200) plaatje = models.ImageField(upload_to='plaatjes/') menu = models.ForeignKey(Menu) seizoenen = models.ManyToManyField(Seizoenen) d

Re: merge images into a webpage

2011-07-09 Thread Shawn Milochik
It would work just fine. Something like this: {% for text, images in my_iterable %} {{ text }} {% for image in images %} {% endfor %} {% endfor %} -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send em

Re: merge images into a webpage

2011-07-09 Thread het.oosten
On Jul 9, 10:36 pm, Shawn Milochik wrote: > Make an iterable in your view (list or tuple) containing lists or tuples > of two items -- the text and the image link. > > Then iterate through that in your template with a 'for' tag. This doesn't work. The webpage text is one object (just one textfiel

Re: merge images into a webpage

2011-07-09 Thread Shawn Milochik
Make an iterable in your view (list or tuple) containing lists or tuples of two items -- the text and the image link. Then iterate through that in your template with a 'for' tag. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this

Re: merge images into a webpage

2011-07-09 Thread het.oosten
> Would using the get_absolute_url() method on your model and then using > that in your tags work? thanks for the reply. This works when you have one dictionary and one template. I want to merge the output of two queries, and render this in a template. Query one gives me: lots of text {{ image1

Re: merge images into a webpage

2011-07-09 Thread Shawn Milochik
On 07/09/2011 03:52 PM, het.oosten wrote: I have two models. One containing images, and one containing the text of a web page. While the text remains the same, the selection of images vary, depending on the session ( I use different themes/moods depending on the season). The selection of images w

merge images into a webpage

2011-07-09 Thread het.oosten
I have two models. One containing images, and one containing the text of a web page. While the text remains the same, the selection of images vary, depending on the session ( I use different themes/moods depending on the season). The selection of images works perfectly, but now i am stuck merging t