1👍
Use this:
from django.core.urlresolvers import reverse
def get_absolute_url(self):
return reverse('catalog_category', kwargs={'category_slug': self.slug})
0👍
Do you ask the user to set the slug when doing data entry or is the slug programmatically created from the name field?
The help text suggests the later, but I don’t see the code? You need to override the save method:
- [Answer]-Django: Tastypie filesize
- [Answer]-Django login form in header
- [Answer]-How to add own form field to instance from models form?
- [Answer]-Django save form with User foreign key
Source:stackexchange.com