Skip to content

Commit

Permalink
fix: import issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BdVade committed Dec 24, 2023
1 parent 423a516 commit 6b1d06b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion restadmin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .sites import site
from .decorators import register
from .restmodeladmin import RestModelAdmin
from .restmodeladmin import RestModelAdmin
4 changes: 2 additions & 2 deletions restadmin/restmodeladmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class RestModelAdmin(ModelViewSet):
and using vanilla ModelViewSet. This will allow implementing
more features in the future
"""
permission_classes = [IsAdminUser] # By default allow admin users only

permission_classes = [IsAdminUser] # By default allow admin users only
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import requests
import setuptools
from setuptools import setup


Expand Down Expand Up @@ -27,7 +28,7 @@
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools'
],
packages=[],
packages=setuptools.find_packages(),
include_package_data=True,
install_requires=["Django>=3.2.9", "djangorestframework", "coreapi"],
package_dir={"": "restadmin"},
Expand Down
7 changes: 3 additions & 4 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from rest_framework.test import APITestCase, override_settings, APIRequestFactory, URLPatternsTestCase
from rest_framework.test import APITestCase, override_settings
from rest_framework.viewsets import ModelViewSet
from rest_framework.permissions import IsAdminUser
from rest_framework.settings import api_settings
Expand All @@ -13,9 +13,6 @@
from django.core.exceptions import ImproperlyConfigured
from django.urls import path, reverse
from django.contrib.auth.models import User
from django.template.response import TemplateResponse
from django.test.client import RequestFactory
import pdb


# Create your tests here.
Expand Down Expand Up @@ -203,6 +200,8 @@ def test_restmodeladmin_list_objects(self):
for i in [10, 20, 30, 40, 50, 60]:
SecondTestModel.objects.create(age=i, name=str(i))
url = reverse("restadmin:admin_SecondTestModel-list")
# This gets only the ages less than 30
# TODO: Refactor this. It's misleading(You think it gets all instances when It get just those less than 30)
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.json()), 2)
Expand Down

0 comments on commit 6b1d06b

Please sign in to comment.