On 8/24/06, DavidA <[EMAIL PROTECTED]> wrote:
>
> The FreeComment model assumes the primary key of the object it refers
> to is an integer, so you can't make the primary key of your model a
> slug, but you can still use a slug on your model:
>
> class Post(models.Model):
>     slug = models.SlugField(prepopulate_from=('title',), unique=True)
>     title = models.CharField(maxlength=80)
>     ...
>
> Since I have slug as 'unique=True' rather than 'primary_key=True'
> Django will auto-generate an integer primary key field ('id').
> -Dave

Thanks Dave, that's what I've done.

I haven't seen this mentioned before, so it might be worth pointing
out in the docs?

Some of the slug examples use slug as PK.  Funnily enough, your blog
example does :)
http://davidavraamides.net/blog/2006/05/11/yet-another-django-blog/

-- 
Derek

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

Reply via email to