You can see the implementation of the SplitField field SplitField in django-model-utils extention:
from django.db import models from model_utils.fields import SplitField class Article(models.Model): title = models.CharField(max_length=100) body = SplitField() >>> a = Article.objects.all()[0] >>> a.body.content u'some text\n\n<!-- split -->\n\nmore text' >>> a.body.excerpt u'some text\n' >>> unicode(a.body) u'some text\n\n<!-- split -->\n\nmore text'
He correctly does exactly what you need. Read more in the doc .
source share