Re: Problem with ORM

2009-01-17 Thread Malcolm Tredinnick
On Fri, 2009-01-16 at 00:38 +0100, Sebastian Bauer wrote: > I think ORM supposed to have save insert and update: > > save(force_insert=False,force_update=False) > update() == save(force_update=True) > insert() == save(force_insert=True) There was a long discussion a couple of years ago about

Re: Problem with ORM

2009-01-16 Thread Sebastian Bauer
W dniu 16.01.2009 16:34, varikin pisze: > > On Jan 15, 5:38 pm, Sebastian Bauer wrote: > >> I think ORM supposed to have save insert and update: >> >> save(force_insert=False,force_update=False) >> update() == save(force_update=True) >> insert() == save(force_insert=True)

Re: Problem with ORM

2009-01-16 Thread varikin
On Jan 15, 5:38 pm, Sebastian Bauer wrote: > I think ORM supposed to have save insert and update: > > save(force_insert=False,force_update=False) > update() == save(force_update=True) > insert() == save(force_insert=True) > > in that situation we could have clean code and

Re: Problem with ORM

2009-01-15 Thread Jacob Kaplan-Moss
> Because I deleted that object. Delete method should be non-reversible > (except in transactions) like "del" statement in Python. Or anybody > knows any reason, why it should be reversible? You didn't delete the object. That'd be spelled ``del instance``. You called a method called ``delete``

Re: Problem with ORM

2009-01-15 Thread Sebastian Bauer
I think ORM supposed to have save insert and update: save(force_insert=False,force_update=False) update() == save(force_update=True) insert() == save(force_insert=True) in that situation we could have clean code and we know that update is realy update on DB i now we can have

Re: Problem with ORM

2009-01-15 Thread Jan Bednařík
On Thu, Jan 15, 2009 at 11:11 PM, Collin Grady wrote: > On Thu, Jan 15, 2009 at 2:09 PM, Jan Bednařík wrote: >> That should not happen. >> >> instance.delete() >> instance.save() >> >> should raise ObjectDoesNotExist exception. Any other behavior

Re: Problem with ORM

2009-01-15 Thread Collin Grady
On Thu, Jan 15, 2009 at 2:09 PM, Jan Bednařík wrote: > That should not happen. > > instance.delete() > instance.save() > > should raise ObjectDoesNotExist exception. Any other behavior is bug. Why? You have a perfectly valid object instance, and you're then saving it.

Re: Problem with ORM

2009-01-15 Thread Jan Bednařík
2009/1/15 Ian Kelly : > On Thu, Jan 15, 2009 at 1:58 AM, Jan Bednařík wrote: >> >> On Wed, Jan 14, 2009 at 6:51 PM, Sebastian Bauer wrote: >>> >>> Hi >>> >>> I think it's a bug, but maybe im wrong: >>> >>> >>> print

Re: Problem with ORM

2009-01-15 Thread Ian Kelly
On Thu, Jan 15, 2009 at 1:58 AM, Jan Bednařík wrote: > > On Wed, Jan 14, 2009 at 6:51 PM, Sebastian Bauer wrote: >> >> Hi >> >> I think it's a bug, but maybe im wrong: >> >> >> print Categories.objects.count() >> >>0 >> new_obj =

Re: Problem with ORM

2009-01-15 Thread James Bennett
On Thu, Jan 15, 2009 at 2:58 AM, Jan Bednařík wrote: > this is happening, because Django ORM is not working as what you > expect from ORM. > > In real ORM, this: No... I don't think you mean "real ORM", I think you mean "identity-mapping ORM". Those terms are not the

Re: Problem with ORM

2009-01-15 Thread Jan Bednařík
On Wed, Jan 14, 2009 at 6:51 PM, Sebastian Bauer wrote: > > Hi > > I think it's a bug, but maybe im wrong: > > > print Categories.objects.count() > >>0 > new_obj = Categories.objects.create(name="test") > instance_1 = Categories.objects.get(pk=new_obj.pk) > instance_2 =

Re: Problem with ORM

2009-01-14 Thread Karen Tracey
On Wed, Jan 14, 2009 at 12:51 PM, Sebastian Bauer wrote: > > Hi > > I think it's a bug, but maybe im wrong: > > > print Categories.objects.count() > >>0 > new_obj = Categories.objects.create(name="test") > instance_1 = Categories.objects.get(pk=new_obj.pk) > instance_2 =

Re: Problem with ORM

2009-01-14 Thread Collin Grady
On Wed, Jan 14, 2009 at 9:51 AM, Sebastian Bauer wrote: > how orm can save second instance of the same row when its deleted? Deleting an object won't magically remove all references to it - the instance_2 variable still has a perfectly valid object, so saving it just

Problem with ORM

2009-01-14 Thread Sebastian Bauer
Hi I think it's a bug, but maybe im wrong: print Categories.objects.count() >>0 new_obj = Categories.objects.create(name="test") instance_1 = Categories.objects.get(pk=new_obj.pk) instance_2 = Categories.objects.get(pk=new_obj.pk) instance_1.delete() print Kategorie.objects.count() >>0