Alex - you are a legend. That's functioning perfectly. I've moved the
import line to the start of the file, but other than that used your
code and it's working a treat.
Thanks for the swift help Alex, and also Karen: together you've
clarified Django very clearly for me.
On Jan 6, 6:01 pm, "Alex Koshelev" <
daeva...@gmail.com> wrote:
> Form class really doesn't have `strip_tags` method. I think you are
> interested in `strip_tags` functon from `django.utils.html`(and your
> comment says the same). So your method may look like this:
>
> def clean_title(self):
> from django.utils.html importstrip_tags
> title =strip_tags(self.cleaned_data["title"])
> return title
>
> On Tue, Jan 6, 2009 at 8:14 PM, ChrisL <
10000angryc...@googlemail.com> wrote:
>
> > Hi everyone,
>
> > Been bashing against this one for a while now and am keen for
> > suggestions. I'm trying to apply custom validation to forms within
> > Django's default admin. First up, I want to strip out all html from a
> > Title field. Following the official documentation I have developed
> > this:
>
> > ----------------------------
>
> > from django.contrib import admin
> > from django import forms
> > from django.utils.html importstrip_tags
> > from queryclick.qc_news.models import *
>
> > #Custom Data Validation in the Admin Interface
> > class MyArticleAdminForm(forms.ModelForm):
> > class Meta:
> > model = Article
>
> > def clean_title(self):
> > #Remove all HTML, usingstrip_tags(import from django.utils.html