I defined a field title in model the max length is 30
title=models.CharField("Title",max_length=30)

while after I key in none - english characters, eg, Chinese and submit
the form, it [database] can only take 10 Chinese characters,otherwise
raise an exception.

I also use an validation rule in the clean_title method in the form to
raise an exception if the length exceeds 6, I meant to only allow 6
Chinese input.

        def clean_title(self):
                title = self.cleaned_data["title"]

                if len(title)> 6:#6 chinese chars
                        raise forms.ValidationError("The message length is 
greater than
allowed: 6 Chinese")

                return title

So now if I enter less than 6 Chinese, then it's valid,The safe range
for db is 30/10*6=18 english words.

I am wondering how I can treat all string from clean_xxx() same,no
mater if it's english or chinese.

btw, is the max_length in model for unicode or just for bytestring?
--~--~---------~--~----~------------~-------~--~----~
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