On Thu, Nov 17, 2011 at 12:48 PM, Mario Gudelj <mario.gud...@gmail.com> wrote: > Hi guys, > I have this issue I can not work out for the life of me. I would really > appreciate it if someone could help. > This is my model: > class Business(models.Model): > ... > slug = models.SlugField("Slug", max_length=255, unique=True, > blank=False) > I have the following function in the models.py file that generates the > unique slug. > def unique_slug(item,slug_source,slug_field): > if getattr(item, slug_field): # if it's already got a slug, do nothing.
Your code does the opposite of this comment - you only enter the code that calculates and sets the slug if the item already has a slug. Cheers Tom -- 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.