Re: slug with ForeignKey

2007-06-01 Thread Malcolm Tredinnick
On Fri, 2007-06-01 at 14:32 -0700, [EMAIL PROTECTED] wrote: > Not sure why this isn't working. > > I have: > > make = models.ForeignKey(Foo) > model = models.CharField(maxlength=100) > slug = models.SlugField(prepopulate_from=('make','model')) > > Foo has > > bar = models.CharField(maxlength=1

Re: slug with ForeignKey

2007-06-01 Thread sansmojo
The easiest way I know of is letting the javascript do its thing and then overriding the save method. Basically, just split the generated slug (which will be something like "1-stuff", where 1 is the id of the Foo instance and "stuff" is the string typed into the model field). Then grab the instan

slug with ForeignKey

2007-06-01 Thread [EMAIL PROTECTED]
Not sure why this isn't working. I have: make = models.ForeignKey(Foo) model = models.CharField(maxlength=100) slug = models.SlugField(prepopulate_from=('make','model')) Foo has bar = models.CharField(maxlength=100, unique=True) def __str__(self): return self.bar So slug should po