0

another noob Django question. The below both work for me, is there any difference or anything I should be aware of ? I'm using Django 1.2.5. Thanks.

o = Staff()
form = StaffForm(request.POST, instance=o)

if form.is_valid():
  o.save(using='dbName')


o = Staff()
form = StaffForm(request.POST, instance=o)

if form.is_valid():
  f = form.save(commit = False)
  f.save(using='dbName')

1 Answer 1

1

The first example does not work - it doesn't update the instance from the form. Use the second.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.