开发者

Django form as GET

I want to have my site having form validation and xml generation by using GET. There will be no form rendering as HTML to fill, simply request will be a GET that parameters are generated automatically via a software.

Here is my form:

from django import forms
class xmlRetrievalForm(forms.Form):
    selected_date = forms.DateField(input_formats=['%d/%m/%Y',], error_messages={'required': 'selected_date is required (ie: 29/11/2011)', 'invalid': 'selected_date field is required (ie: 29/11/2011)'})
    start_time = forms.TimeField(error_messages={'required': 'start time is required (ie: 13:11)', 'invalid': 'start_time field is required (ie: 13:11)'})
    end_time = forms.TimeField(error_messages={'required': 'end time is required (ie: 13:11)', 'invalid': 'end_time field is required (ie: 13:11)'})
    channel_name = forms.CharField(max_length=30, error_messages={'required': 'channel_name 
field is required', 'invalid': 'enter a valid channel_name.'})开发者_开发知识库

Now instead of POST, I need to receive form data as GET parameters,

How can I achieve this in the view ?

Regards


I can't imagine where you are having trouble. Simply replace request.POST with request.GET when you instantiate the form.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜