some time; doesn't help starting Django whilst still learning Python
and OOP.
The following works perfectly:
@login_required
@transaction.commit_on_success
def update_log(request, pk):
if request.method == 'POST' and request.is_ajax():
form = LogForm(request.POST, prefix='log')
if form.is_valid():
log = form.save(commit=False)
log.person_id = pk
log.user = request.user
log.save()
response_dict = {}
response_dict.update({'success': True})
return HttpResponse(json.dumps(response_dict),
mimetype="application/json")
else:
return HttpResponse(json.dumps(form.errors),
mimetype="application/json")
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment