Hello, I just updated to the latest django dev version and it changed
the behavior of my code (not suprisingly :)  Get data from a form,
save it to the DB, then in the same save function get the id from what
was just saved, update a values and save it again.  I need to do this
to get the id of what was just saved, so I can update a field in that
record based on that ID  Now instead of maintaining the username on
the second save, it overwrites it with the user_id.  Here is the an
outline of the code that used to work:

class EditFooForm(ModelForm):
  class Meta:
    model = Foo

def save(self, <some args passed in>):
  foo = Foo()
  foo.id = some_user_id
  foo.username='awesome_user'
  foo.title = 'my great title'
  foo.submit_date=datetime.datetime.now()
  foo.save()

  # We're OK here!
  # The DB has username as 'awesome_user' and user_id as '1234'

  my_new_title = '%s_%s' % ( foo.id, some_file_name  )
  foo.title = my_new_title
  foo.save()

  #Issue:  username for that record in the DB is now '1234'

I am by no means a Django expert, but this code has worked for months
so I'm sure I'm missing something simple.  Any help would be greatly
appreciated!

Thanks,

T
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to