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

Remove section regarding custom queryset methods from README #1865

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,54 +177,6 @@ class AuthenticatedHttpRequest(HttpRequest):

And then use `AuthenticatedHttpRequest` instead of the standard `HttpRequest` for when you know that the user is authenticated. For example in views using the `@login_required` decorator.

### My QuerySet methods are returning Any rather than my Model

If you are using `MyQuerySet.as_manager()`:

Example:

```python
from django.db import models

class MyModelQuerySet(models.QuerySet):
pass


class MyModel(models.Model):
bar = models.IntegerField()
objects = MyModelQuerySet.as_manager()


def use_my_model() -> int:
foo = MyModel.objects.get(id=1) # Should now be `MyModel`
return foo.xyz # Gives an error
```

Or if you're using `Manager.from_queryset`:

Example:

```python
from django.db import models


class MyModelQuerySet(models.QuerySet):
pass


MyModelManager = models.Manager.from_queryset(MyModelQuerySet)


class MyModel(models.Model):
bar = models.IntegerField()
objects = MyModelManager()


def use_my_model() -> int:
foo = MyModel.objects.get(id=1) # Should now be `MyModel`
return foo.xyz # Gives an error
```

### Why am I getting incompatible return type errors on my custom managers?

If you declare your custom managers without generics and override built-in
Expand Down