Hi,
Is it possible to find out the ID of the record being inserted?
To explain what I mean:
Let's suppose the example at
http://www.djangoproject.com/documentation/forms/
####################################
def create_place(request):
manipulator = places.AddManipulator()
if request.POST:
# If data was POSTed, we're trying to create a new Place.
new_data = request.POST.copy()
# Check for errors.
errors = manipulator.get_validation_errors(new_data)
if not errors:
# No errors. This means we can save the data!
## IS IT POSSIBLE HERE TO FIND OUT the ID of record that
will consist of the data?
manipulator.do_html2python(new_data)
new_place = manipulator.save(new_data)
# Redirect to the object's "edit" page. Always use a
redirect
# after POST data, so that reloads don't accidently create
# duplicate entires, and so users don't see the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/places/edit/%i/" %
new_place.id)
else:
# No POST, so we want a brand new form without any data or
errors.
errors = new_data = {}
# Create the FormWrapper, template, context, response.
form = formfields.FormWrapper(manipulator, new_data, errors)
return render_to_response('places/create_form', {'form': form})
#############
and on line 10 I marked where I would like to find out the record id.
So, is it possible?
Thank you for reply
l.