Thanks for the quick feedback. I'm starting my "try" and I'm sure it will work.
On Dec 16, 3:42 pm, Itay Donenhirsch <i...@bazoo.org> wrote: > and ofcourse that should be: > b.save() > and not without the ()s > > > > On Wed, Dec 16, 2009 at 5:40 PM, Itay Donenhirsch <i...@bazoo.org> wrote: > > try: > > b = Att.objects.get( pk = whatever_you_like ) > > b.fieldname = a_variable > > b.save > > except Att.DoesNotExist: > > print "oy vey" > > > you could also replace b.fieldname = ... with: > > b.__setattr__( 'fieldname', a_variable ) > > > itay > > > On Wed, Dec 16, 2009 at 5:35 PM, rmschne <rmsc...@gmail.com> wrote: > >> Am I missing something? I want to be able to update just one field in > >> one records of a database via the Django data model. If I create an > >> object for that record and update that one field, via > > >> b=Att(fieldname=a_variable) > >> b.save > > >> It creates a new record with all other fields blank. For simplicity > >> (and scalability of code), I'd prefer not to create a new record, nor > >> do I want to put in all the field names. > > >> I undestand how I could (but have not yet done this) write custom SQL > >> to do this; but is there a way using the native Django method of > >> updating existing database? > > >> -- > > >> You received this message because you are subscribed to the Google Groups > >> "Django users" group. > >> To post to this group, send email to django-us...@googlegroups.com. > >> To unsubscribe from this group, send email to > >> django-users+unsubscr...@googlegroups.com. > >> For more options, visit this group > >> athttp://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.