Sunday, February 26, 2012

Using query set in views.py

Hello,

I was wondering if we are able to use querysets in views.py so i can use one of the columns in my method below:


def keyword_subscribe(request):
    keyword= ''
    if request.method == 'POST':
    subscription_days = "7"
new_keyword = request.POST.get('myTextField')
    new_keyword_subscribed = subscribe_keyword(username,subDay =7,KEYWORD_SET=frozenset())        
                                                
        response = simplejson.dumps({'new_keyword': new_keyword_subscribed})                                              
    else:
        html = form.errors.as_ul()
        response = simplejson.dumps({'success':'False', 'html':html})
    if request.is_ajax():
        return HttpResponse(response, mimetype='application/json')
    else:
        return HttpResponseRedirect("/")

Best Regards,

Stanwin Siow



No comments:

Post a Comment