Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » What is the best way to do related items? [RSS Feed]

#1 Dec. 1, 2005 13:11:48

Milton W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

What is the best way to do related items?


Hi All,

I'm back around to working out how to best implement related items,
since you can't manytomany join onto self I plan to do a calculation
and cache the result.

What I would like to do is to have a post (eg. a blog post) object and
then be able to have something like the following in my template:

{% for related in post.getRelated %}
........

where getRelated is a method of the actual post model which returns a
list of related posts. Setting this up isn't a problem and doing the
calculations isn't a problem, though where I'm stuck is how can I get
a list of posts from within a post object, if I was anywhere else I
would call something like posts.get_list(...), though clearly this
won't work from within an object that is trying to get a list of
itselfs (great english eh ;)

I've tried self.get_list though obviously it doesn't exist.

Any help appreciated.

Offline

#2 Dec. 1, 2005 14:52:59

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

What is the best way to do related items?


On 12/1/05, Milton Waddams <> wrote:
> I've tried self.get_list though obviously it doesn't exist.

Just plain "get_list" should work. Give that a shot.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#3 Dec. 2, 2005 00:10:57

Milton W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

What is the best way to do related items?


just what I needed, thanks!

On 12/2/05, Adrian Holovaty <> wrote:
>
> On 12/1/05, Milton Waddams <> wrote:
> > I've tried self.get_list though obviously it doesn't exist.
>
> Just plain "get_list" should work. Give that a shot.

Offline

  • Root
  • » Django
  • » What is the best way to do related items? [RSS Feed]

Board footer

Moderator control

Enjoy the 20th of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support