瀏覽代碼

Specify `__all__` in `mixins` and `generics`

This fixes #2 by specifically saying what will be imported from
`mixins.py` and `generics.py` when a star import is done on these
files.  This is done within `__init__.py`, so the classes can be
imported directly from there.  This prevents an issue where
`rest_framework.mixins` was being imported from `generics.py`, so
users were not able to import `rest_bulk_create.mixins`.
Kevin Brown 11 年之前
父節點
當前提交
aecad13b24
共有 3 個文件被更改,包括 10 次插入2 次删除
  1. 2 2
      README.rst
  2. 5 0
      rest_framework_bulk/generics.py
  3. 3 0
      rest_framework_bulk/mixins.py

+ 2 - 2
README.rst

@@ -135,5 +135,5 @@ Credits
 
 
 Current maintainers:
 Current maintainers:
 
 
-* Miroslav Shubernetskiy - `GitHub <https://github.com/miki725>`_.
-
+* Miroslav Shubernetskiy - `GitHub <https://github.com/miki725>`_
+* Kevin Brown - `GitHub <https://github.com/kevin-brown>`_

+ 5 - 0
rest_framework_bulk/generics.py

@@ -4,6 +4,11 @@ from rest_framework.generics import GenericAPIView
 from . import mixins as bulk_mixins
 from . import mixins as bulk_mixins
 
 
 
 
+__all__ = ["BulkCreateAPIView", "BulkUpdateAPIView", "BulkDestroyAPIView", "ListBulkCreateAPIView",
+           "ListCreateBulkUpdateAPIView", "ListCreateBulkUpdateDestroyAPIView", "ListBulkCreateUpdateAPIView",
+           "ListBulkCreateUpdateDestroyAPIView"]
+
+
 ##########################################################
 ##########################################################
 ### Concrete view classes that provide method handlers ###
 ### Concrete view classes that provide method handlers ###
 ### by composing the mixin classes with the base view. ###
 ### by composing the mixin classes with the base view. ###

+ 3 - 0
rest_framework_bulk/mixins.py

@@ -5,6 +5,9 @@ from rest_framework.mixins import CreateModelMixin
 from rest_framework.response import Response
 from rest_framework.response import Response
 
 
 
 
+__all__ = ["BulkCreateModelMixin", "BulkUpdateModelMixin", "BulkDestroyModelMixin"]
+
+
 class BulkCreateModelMixin(CreateModelMixin):
 class BulkCreateModelMixin(CreateModelMixin):
     """
     """
     Either create a single or many model instances in bulk by using the
     Either create a single or many model instances in bulk by using the