On Mon, Mar 31, 2008 at 6:46 AM, James Bennett <[EMAIL PROTECTED]> wrote:
>  Since subclassing Field to create your own custom model fields is easy
>  and documented, why not write an "HTMLField" class which calls
>  mark_safe() before returning a value?

And though I may be wrong, I think it'd be as simple as:

from django.db.models import TextField
from django.utils.safestring import mark_safe

class HTMLField(TextField):
    def to_python(self, value):
        return mark_safe(value)




-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to