You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@sunjoomoon, to use with django you need django-autoslug then...
#models.pyfromdjango.dbimportmodelsfromautoslugimportAutoSlugFieldclassArticle(models.Model):
'''An article with title, date and slug. The slug is not totally unique but there will be no two articles with the same slug within any month. '''title=models.CharField(max_length=200)
pub_date=models.DateField(auto_now_add=True)
slug=AutoSlugField(populate_from='title', unique_with='pub_date__month')
#models.pyfromdjango.dbimportmodelsfromautoslugimportAutoSlugFieldfromslugifyimportslugifyclassArticle(models.Model):
'''An article with title, date and slug. The slug is not totally unique but there will be no two articles with the same slug within any month. '''title=models.CharField(max_length=200)
pub_date=models.DateField(auto_now_add=True)
slug=AutoSlugField(populate_from='title', unique_with='pub_date__month', slugify=slugify)
As a newbie, having tried many but without success, any working example ?
The text was updated successfully, but these errors were encountered: