I want to create a slug field from my title field on save. An example in django is below. Is it possible to do the save thing with peewee?
from django.template.defaultfilters import slugify
Class Blog(models.Model):
title = models.CharField(max_length=40)
slug = models.SlugField(_('slug'), max_length=60, blank=True)
#Then override models save method:
def save(self):
#Only set the slug when the object is created.
self.slug = slugify(self.title) #Or whatever you want the slug to use
super(Blog, self).save()