Hi all.  I'm needing to learn how to tap into the clean data for
forms.  I'm looking at   
http://docs.djangoproject.com/en/dev/ref/forms/validation/
trying to figure things out.

By my understanding, raw data needs to be cleaned before insertion
into the database.  I have a few questions:

1.  what does cleaning actually do... prevent sql query injections?
Anything else?

2.  I'm assuming, if I had a function as follows:

    def clean(self):
        cleaned_data = self.cleaned_data
        return cleaned_data

That this would return a dictionary of  the form in it's cleaned
state.  Is this a correct assumption?

3.  How would I call this when saving data?  Lets say I have this in
my view which saves the data to the database:

                        mydata=Mydata(
                                description=request.POST.get('description',''),
                                sku = request.POST.get('sku',''),
                        mydata.save()

is it as simple as wrapping the request.POST.get... in clean()?


TIA


--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to