based on the docs, update() Performs an SQL update query for the specified 
fields, and returns the number of rows matched.
I have tried updating a model using it on *django 1.7.1* with both sqlite 
and postgres but my test suite keeps failing and indicating no update.

Here is what i have tried.

    

    def create_session(self, email='devito@gmailcom', 
date=datetime.datetime.now(),
                       duration=datetime.timedelta(hours=1)):
        new_user = UserFactory(email=email)
        sf = TutorSessionFactory(tutor_with_skill=self.ts, buyer=new_user,
                            date=date,duration=duration)
        return sf

    def test_can_update_ehen_udated(self):
        result = self.create_session()
        *Session.objects.filter(id=result.id).update(price=Decimal('700'))*
        self.assertEqual(result.price,Decimal('700'))

and below is the result from the test suite

    Failure
Traceback (most recent call last):
  File "C:\Python27\Lib\unittest\case.py", line 329, in run
    testMethod()
  File 
"F:\work-projects\python\django-projects\Tuteria\tuteria\tutor_sessions\tests\test_model.py",
 
line 24, in test_can_update_ehen_udated
    self.assertEqual(result.price,Decimal('700'))
  File "C:\Python27\Lib\unittest\case.py", line 513, in assertEqual
    assertion_func(first, second, msg=msg)
  File "C:\Python27\Lib\unittest\case.py", line 506, in _baseAssertEqual
    raise self.failureException(msg)
AssertionError: 500 != Decimal('700')

Pls can someone confirm is my suspicions are valid. thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4418f4e6-bce1-4dbc-9468-a39233932fb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to