if form save is successful, redirect

This commit is contained in:
Sanj 2012-07-20 03:31:17 +05:30
parent 71e92dd3bb
commit d0eaa41bb1
2 changed files with 7 additions and 2 deletions

View File

@ -5,7 +5,7 @@ from django.shortcuts import render_to_response
from ox.django.shortcuts import render_to_json_response
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.template import RequestContext
from django.http import HttpResponse
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib.auth.decorators import login_required
@ -30,9 +30,14 @@ def edit_profile(request):
if form.is_valid():
instance = form.save()
form.save()
all_valid = True
for inline in inlines:
if inline.is_valid():
inline.save()
else:
all_valid = False
if all_valid:
return HttpResponseRedirect("/edit_profile/")
else:
form = PersonForm(instance=person)

View File

@ -77,7 +77,7 @@ $(function(){
}
});
var id = $this.attr("data-id");
console.log(id);
//console.log(id);
if ($.trim(id) !== '') {
var title = $this.attr("data-title");
$this.select2("val", {'id': id, 'title': title});