while creating a blog i am using the following model class and form .but since i don't want the user to add the url(slugified field) himself i am stuck how can i add the slugified url before saving the model,should it be done in the view if i am correct. PS: i am using app engine where i heard that the slug fields aren't available.
class Post(db.Model):
title=db.StringProperty(required=True)
url=db.StringProperty(required=True)
content_html=db.TextProperty(required=True)
dateTime=db.DateTimeProperty(auto_now_add=True,required=True)
tags=db.StringListProperty()
class PostForm(djangoforms.ModelForm):
class Meta:
model=Post
exclude=['url']
You could either do this in your view or override your form's save method. If you do it in your view it will look something like this:
Alternatively, you can override your form's save method which would look something like: