<s> from django import forms <EOL> from django . db import models <EOL> from django . template import RequestContext <EOL> from django . template . loader import render_to_string <EOL> from django . utils . translation import ugettext_lazy as _ <EOL> from portlets . models import Portlet <EOL> class TextPortlet ( Portlet ) : <EOL> """<STR_LIT>""" <EOL> text = models . TextField ( _ ( u"<STR_LIT>" ) , blank = True ) <EOL> class Meta : <EOL> app_label = '<STR_LIT>' <EOL> def __unicode__ ( self ) : <EOL> return u"<STR_LIT:%s>" % self . id <EOL> def render ( self , context ) : <EOL> """<STR_LIT>""" <EOL> request = context . get ( "<STR_LIT>" ) <EOL> return render_to_string ( "<STR_LIT>" , RequestContext ( request , { <EOL> "<STR_LIT:title>" : self . title , <EOL> "<STR_LIT:text>" : self . text <EOL> } ) ) <EOL> def form ( self , ** kwargs ) : <EOL> return TextPortletForm ( instance = self , ** kwargs ) <EOL> class TextPortletForm ( forms . ModelForm ) : <EOL> """<STR_LIT>""" <EOL> class Meta : <EOL> model = TextPortlet <EOL> exclude = ( ) </s>
