saving data using cleaned data method

773 views
Skip to first unread message

Arumuga Odhuvar Sekkizhar

unread,
Apr 16, 2015, 1:25:26 AM4/16/15
to django...@googlegroups.com
Good Morning,
I am trying to save data in the table using cleaned data by get and post method in the view.
How will I trace step by step the movement of data which is  to be saved in the database?

My problem is there is know error while running the program. But i did not see any data saved in the table in postgres. Where is the data? where can i find the data? [ i Used IPDP() ]

View

def post(self,request,**kwargs):
        if request.method == 'POST':


            form=dms_school_gis_info_form(request.POST)
           
        if form.is_valid():
            form.process()

            cd = dms_school_gis_info(
                tempid_id = form.cleaned_data['tempid'],
                latitude=form.cleaned_data['latitude'],
                longitude=form.cleaned_data['longitude'],
                )           
            cd.save()

Form  

class dms_school_gis_info_form(forms.Form):
    tempid = forms.CharField()
    latitude=forms.CharField()
    longitude=forms.CharField()

    def process(self):
        cd = self.cleaned_data



Please help me

Sekkizhar

Pavel Kuchin

unread,
Apr 16, 2015, 5:10:26 AM4/16/15
to django...@googlegroups.com
Hi Sekkizhar,

I think django.forms.ModelForm is exactly what you are looking for. (https://docs.djangoproject.com/en/1.8/topics/forms/modelforms/#modelform)

Yours sincerely,
Pavel.
Reply all
Reply to author
Forward
0 new messages