citusdata / citusdata/django-multitenant
Issue with using TenantModel in DjangoRestFramework viewsets
Open
tips & tricks
view integration
- Dominant language
- Python
- Stars
- 823
- Forks
- 126
- PR merge metrics
- No merged PRs in 30d
Description
To use TenantModel with Django Rest Framework's ViewSets, the following refactor was necessary:
```python
# before
class MyModelViewSet(GenericViewSet):
queryset = MyModel.objects.all()
```
```python
# after
class MyModelViewSet(GenericViewSet):
def get_queryset(self):
return MyModel.objects.all()
```
Contributor guide
Assessment
This issue has not been assessed yet.