Thanks for the feedback. Tim, I tried that but no luck. Here are my
models:

from django.db import models

class PortfolioImage(models.Model):
        image = models.ImageField(upload_to="portfolio", core=True)
        alt_attribute = models.CharField(maxlength=100)

        def __str__(self):
                return self.image.split("/")[-1]

        def get_absolute_url(self):
                return "/media/portfolio/%s" % self

        class Admin:
                pass

class PortfolioItemImageSet(models.Model):
        title = models.CharField(maxlength=100, core=True)
        slug = models.SlugField(prepopulate_from=("title",))
        thumb = models.ForeignKey(PortfolioImage, related_name="set_thumb",
help_text="Max 400px")
        image = models.ForeignKey(PortfolioImage, related_name="set_image",
help_text="Max 800px")

        portfolioitem = models.ForeignKey("PortfolioItem",
related_name="image_sets", edit_inline=models.TABULAR, num_in_admin=5,
num_extra_on_change=3)

        class Admin:
                pass

        def __str__(self):
                return self.title

class PortfolioItem(models.Model):
        title = models.CharField(maxlength=100)
        slug = models.SlugField(prepopulate_from=("title",))
        summary = models.TextField(help_text="Use Markdown. One paragraph.")
        description = models.TextField(help_text="Use Markdown.")
        media = models.CharField(blank=True, maxlength=100)
        size = models.CharField(blank=True, maxlength=30)
        price = models.IntegerField(blank=True, maxlength=15)
        completed = models.DateField(blank=True)

        # image_sets ==(One To Many)==> PortfolioItemImageSet

        item_thumb = models.ForeignKey(PortfolioImage, help_text="150 by 150
pixels")

        def __str__(self):
                return self.title

        def get_absolute_url(self):
                return "/portfolio/%s" % (self.slug)

        class Admin:
                fields = (
                        (None, {
                                'fields': ('title', 'slug', 'summary', 
'description')
                        }),
                        ('Details', {
                                'fields' : ('item_thumb', 'media', 'size', 
'price', 'completed',)
                        }),
                )

-----------------------------------------------------

This is my current template:

{% extends "base.html" %}

{% block title %} {{ object.title|escape }} {% endblock %}


{% block image %} <img src="{{ object.image }}"
alt="{{ object.alt_attribute }}"/>{% endblock %}


{% block info %}

        <ul>
                <li>{{ object.media }}</li>
                <li>{{ object.size }}</li>
                <li>${{ object.price }}</li>
                <li>{{ object.completed }}</li>
        </ul>

{% endblock %}

{% block content %}

    {{ object.description }}

{% endblock %}

This template is portfolioitem_detail.html.

Thanks for all of the help and let me know if their is anything I can
improve.


On Oct 24, 10:12 am, Tim <[EMAIL PROTECTED]> wrote:
> Try
>
> <img src="{{ object.get_PortfolioImage_url }}" />
>
> Tim
>
> On Oct 24, 9:37 am, Steve  Potter <[EMAIL PROTECTED]> wrote:
>
> > On Oct 24, 1:35 am, Page <[EMAIL PROTECTED]> wrote:
>
> > > I'm new to Django and Python but trying to catch on. I have an image
> > > model for a portfolio page. I also have a model for the portfolio
> > > information for that page.
>
> > > After creating a template for the portfolio item detail page I can
> > > pull in of the fields by simply including a template tag like
> > > {{ object.size }} and it pulls all of them in.
>
> > > But I cannot for the life of me get the image to work. The image class
> > > is named PortfolioImage and I have tried endless variation of
> > > {{  image.PortfolioImage }} etc using object and everything else I
> > > came accross. The app is named portfolio so I've tried
> > > portfolio.PortfolioImage and endless combinations as well.
>
> > > I've looked at the documentation in the Admin section of the site and
> > > it has information on the models and the fields available and has
> > > image available, I just can't seem to get it to pull in the URL into
> > > the <img> tag in the template.
>
> > > Am I just missing some Python context somewhere or is there something
> > > I need to do to make the image available in my template.
>
> > > Any help greatly appreciated.
>
> > The fact that you are using {{ object.size }} makes me think that you
> > are using generic views.  If this is the case you should be able to
> > use {{ object.imagefieldname }}  where imagefieldname is the name that
> > you used in your models.py   If you are not using generic views I
> > would need to see the relevant sections of your models.py and views.py
> > to tell you what you need.
>
> > Steve


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

Reply via email to