if form save is successful, redirect
This commit is contained in:
parent
71e92dd3bb
commit
d0eaa41bb1
|
@ -5,7 +5,7 @@ from django.shortcuts import render_to_response
|
||||||
from ox.django.shortcuts import render_to_json_response
|
from ox.django.shortcuts import render_to_json_response
|
||||||
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
from django.core.paginator import Paginator, InvalidPage, EmptyPage
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,9 +30,14 @@ def edit_profile(request):
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
instance = form.save()
|
instance = form.save()
|
||||||
form.save()
|
form.save()
|
||||||
|
all_valid = True
|
||||||
for inline in inlines:
|
for inline in inlines:
|
||||||
if inline.is_valid():
|
if inline.is_valid():
|
||||||
inline.save()
|
inline.save()
|
||||||
|
else:
|
||||||
|
all_valid = False
|
||||||
|
if all_valid:
|
||||||
|
return HttpResponseRedirect("/edit_profile/")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
form = PersonForm(instance=person)
|
form = PersonForm(instance=person)
|
||||||
|
|
|
@ -77,7 +77,7 @@ $(function(){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var id = $this.attr("data-id");
|
var id = $this.attr("data-id");
|
||||||
console.log(id);
|
//console.log(id);
|
||||||
if ($.trim(id) !== '') {
|
if ($.trim(id) !== '') {
|
||||||
var title = $this.attr("data-title");
|
var title = $this.attr("data-title");
|
||||||
$this.select2("val", {'id': id, 'title': title});
|
$this.select2("val", {'id': id, 'title': title});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user