コード例 #1
0
ファイル: views.py プロジェクト: mattkatz/Valentunes
def index(request,template_name='index.html'):
    if request.method == 'POST':
        #handle the poste
        form = CardModelForm(request.POST)
        if form.is_valid():
            #handle the form, insert stuff
            new_object = form.save()
            if new_object.to_name != "":
                new_object.get_tracks()
                new_object.get_track_urls()
            return HttpResponseRedirect('/choose/%s/'%new_object.id) 
    else:
        form = CardModelForm()
    context = {'form':form}
    return render_to_response(template_name, context,context_instance=RequestContext(request))
コード例 #2
0
ファイル: handlers.py プロジェクト: apassant/Valentunes
 def create(self, request):
     f = CardModelForm(request.POST)
     if f.is_valid():
         new_object = f.save()
         return new_object
     return rc.BAD_REQUEST