Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed F's asc and desc args #1213

Merged
merged 2 commits into from Oct 28, 2022
Merged

Fixed F's asc and desc args #1213

merged 2 commits into from Oct 28, 2022

Conversation

g-as
Copy link
Contributor

@g-as g-as commented Oct 28, 2022

I have made things!

Fixed asc and desc signature by removing expression.

I also updated BaseExpression's asc and desc (they are the same).

class OrderBy(Expression):
    ...

    def __init__(self, expression, descending=False, nulls_first=False, nulls_last=False):
        ...

    ...

@deconstructible
class F(Combinable):
    """An object capable of resolving references to existing query objects."""

    ...

    def asc(self, **kwargs):
        return OrderBy(self, **kwargs)

    def desc(self, **kwargs):
        return OrderBy(self, descending=True, **kwargs)
        
    ...

Related issues

@@ -121,15 +132,13 @@ class F(Combinable):
def asc(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need these method? They are duplicating the BaseExpression ones.
Or is it django-version specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

F doesn't inherit from BaseExpression but from class Combinable:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I am sorry :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sobolevn
Copy link
Member

Thank you! 👍

@sobolevn sobolevn merged commit 875acf7 into typeddjango:master Oct 28, 2022
@g-as
Copy link
Contributor Author

g-as commented Oct 28, 2022

Cheers.

@g-as g-as deleted the bugfix/f_asc_desc branch October 28, 2022 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants