orator icon indicating copy to clipboard operation
orator copied to clipboard

I use with_trashed method load softdelete data but it not work.

Open viweei opened this issue 8 years ago • 2 comments

Hello again .

I would like to include in the record has been deleted users.

class User(SoftDeletes, Model):
    __dates__ = ['deleted_at']

class Lotteries(Model):
    @belongs_to
    def user(self):
        return User.with_trashed()

result = Lotteries.with_('user').get()

But I get the SQL statement, still have the condition users.deleted_at IS NULL

It took 6.31ms to execute the query SELECT * FROM `lotterys`
It took 2.17ms to execute the query SELECT * FROM `users` WHERE (`users`.`id` IN (103, 104)) AND (`users`.`deleted_at` IS NULL)

If only query the user it is right.

User.with_trashed().get()

i am doing wrong?

viweei avatar Mar 18 '17 02:03 viweei

is there any update over this issue?

JahangerGull avatar Nov 27 '19 01:11 JahangerGull

For other people that may have this issue: You can install this pull request with: pip install git+https://github.com/sdispater/orator.git@refs/pull/350/merge which fixes the problem.

bl4val avatar Jun 22 '21 11:06 bl4val