OK, again I'm stumpped.

I have the following models:

class Portfolio(models.Model):
        user        = models.ForeignKey(User)
        description = models.CharField(maxlength=50)
        notes       = models.CharField(maxlength=200)


class Holding(models.Model):
        porfolio = models.ForeignKey(Portfolio)
        symbol   = models.CharField(maxlength=10)

Heres my view to get a list of holdings for a particular portfolio:

def list_of_holdings(request, portfolio_id):
        from django.views.generic.list_detail import object_list

        p = Portfolio.objects.get(pk=portfolio_id)
        ol = p.holding_set.all()

        return object_list(request, ol,
template_name='aim/portfolio_entries.html'

So if the portfolio_id i pass has holdings, the routine works great,
but if the ID i pass in has no holdings, I get a 404 error page not
found.

It must be the empty set being passed to object_list, no?

Help i'm stumpped.

Thanks all


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