On Wednesday 23 September 2009 17:06:44 Justin Myers wrote: > Two ideas: > 1. Instead of having the slug prepopulated, override save() [1] and > run slugify yourself. > 2. Instead of running slugify on the name, why not just access its > slugfield directly? > > HTH, > Justin > > [1] > http://docs.djangoproject.com/en/dev/topics/db/models/#overriding-predefin > ed-model-methods > > On Sep 22, 4:17 pm, Amos <a...@amos-site.org.uk> wrote: > > I have an Admin form with a slugfield prepopulated from the name of the > > news item I'm creating. > > > > In one of my templates I have a link created using the slugify filter > > applied to the name of the news item. > > > > When I create an object with a name such as "A New Story" the prepoulated > > field contains "new-story", but slugify generates "a-new-story" and hence > > my link doesn't point to the correct news story. > > > > Is there any way of ensuring that the two functions generate the same > > slug? > > > > Cheers > > Amos > > -- > > > > My Web Design Business > > >
I've changed it to do the second of these, but I was just wondering why the two seemingly related things don't do the same thing. -- My Web Design Business --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---