Re: get object qs with certain generic relation

2007-08-03 Thread Bram - Smartelectronix
Jonathan Buchanan wrote: > class Flag(models.Model): > objects = FlagManager() > > Usage:: > > songs = Flag.objects.get_by_model_and_flag_type(Song, 'illegal') Thanks a lot Jonathan... I guess I should adding custom managers to all my classes containing generic relations! - bram

Re: get object qs with certain generic relation

2007-08-03 Thread Jonathan Buchanan
> '%s.%s = %s.object_id' % > (backend.quote_name(Model._meta.db_table), > > backend.quote_name(Model._meta.pk.column), > rel_table) Aargh, mangled by Gmail - these lines should look like this (with the proper level of indentation

Re: get object qs with certain generic relation

2007-08-03 Thread Jonathan Buchanan
> I have a generic relation Flag, with a FlagType: > > class FlagType(models.Model): > name = models.CharField(maxlength=50) > description = models.TextField() > > class Flag(models.Model): > type = models.ForeignKey(FlagType) # type of flag > content_type =

Re: get object qs with certain generic relation

2007-08-03 Thread [EMAIL PROTECTED]
On Aug 3, 1:31 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Aug 3, 12:54 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> > wrote: > > > > > hello all, > > > I have a generic relation Flag, with a FlagType: > > > class FlagType(models.Model): > > name =

Re: get object qs with certain generic relation

2007-08-03 Thread [EMAIL PROTECTED]
On Aug 3, 12:54 pm, Bram - Smartelectronix <[EMAIL PROTECTED]> wrote: > hello all, > > I have a generic relation Flag, with a FlagType: > > class FlagType(models.Model): > name = models.CharField(maxlength=50) > description = models.TextField() > > class Flag(models.Model): > type

get object qs with certain generic relation

2007-08-03 Thread Bram - Smartelectronix
hello all, I have a generic relation Flag, with a FlagType: class FlagType(models.Model): name = models.CharField(maxlength=50) description = models.TextField() class Flag(models.Model): type = models.ForeignKey(FlagType) # type of flag content_type =