躺在沙滩上的小猪

快乐的每一天

#

Django Generic Views: CRUD

A good article about generic views:

http://www.postneo.com/2005/08/17/django-generic-views-crud

posted @ 2005-12-30 11:48 martin xus| 编辑 收藏

[Django]从Request中获取参数。

昨天犯了个错误,今天补上:)

http://www.4ya.cn/pages/viewpage.action?pageId=409


posted @ 2005-12-30 10:24 martin xus| 编辑 收藏

Can't get params from HttpRequest.POST

I create a template following django's document:

<h1>{{poll.question}}</h1>
{%if error_message%}
<p><strong>{{error_message}}</strong></p>{%endif%}

<form action="/polls/{{poll.id}}/vote" method="post">
    {%for choice in poll.get_choice_list%}
        
<input type="radio" name="choice" id="choice{{forloop.counter}}" value="{{choice.id}}"/>
        
<label for="choice{{forloop.counter}}">{{choice.choice}}</label><br/>
    {%endfor%}
    
<input type="submit" value="Vote">
</form>

And try to get params from post in python:

def vote(request, poll_id):
    p 
= get_object_or_404(polls, pk=poll_id)
    
print request.GET
    
print request.POST    
    
return HttpResponseRedirect('/polls/%s/results/' % p.id)

But the result was null:(

{}
{}

While I change the method to get

<form action="/polls/{{poll.id}}/vote" method="get">

I can get the params's value.
{'choice': ['1']}
{}

I don't know why,I wanna help!

posted @ 2005-12-29 12:47 martin xus| 编辑 收藏

more Custometing Your Confluence Spaces.

nop

posted @ 2005-12-22 16:10 martin xus| 编辑 收藏

JavaScript的数组&Java中的数组

不知道为什么,我换了IE7,编辑只有一个TextArea,其余啥都没有了,同时在我的FireFox中,不能对代码很好的表现。

新弄了个Confluence把文章放那了

http://www.4ya.cn/pages/viewpage.action?pageId=260

posted @ 2005-12-09 22:16 martin xus| 编辑 收藏

仅列出标题
共28页: First 上一页 12 13 14 15 16 17 18 19 20 下一页 Last