Generic Relations: questions

2010-08-18 Thread v0idnull
I asked a while back about having generic relations and someone pointed me to http://docs.djangoproject.com/en/1.2/ref/contrib/contenttypes/#generic-relations This wasn't what I was looking for. What I was looking for is this model I made: class Relationship(models.Model): id = fields.UU

Re: Flexible relationships - tips/advice?

2010-08-04 Thread v0idnull
Sorry, I screwed up my description: Photos, Videos, other Articles, etc, can be related to one Article. However, an Article can also be related to a Photo, though the relationship would symbolize something different then say, the assets of the content. On Aug 4, 7:32 pm, v0idnull wrote: >

Flexible relationships - tips/advice?

2010-08-04 Thread v0idnull
I want to be able to link one model to another model, regardless of what models they are. Articles can be related to Photos, Videos, other Articles, etc etc etc. I have created a Relationship model to represent these relationships, but I'm unsure if this is the best solution. First off, my require

Re: How to get the model name of an object in template?

2010-08-04 Thread v0idnull
i know this isn't what you want, but I'd use the Content Type middleware. def getType(self): if (self._type == None): self._type = ContentType.objects.get_for_model(self) return self._type for me personally this worked out well, but mostly because I have an abstrac