mirror of
https://github.com/Hopiu/django-select2.git
synced 2026-03-19 23:00:24 +00:00
Adds napoleon to march to google style signatures
This commit is contained in:
parent
d25e733c85
commit
d57b726d34
3 changed files with 39 additions and 29 deletions
|
|
@ -177,11 +177,10 @@ class HeavySelect2Mixin(Select2Mixin):
|
|||
"""
|
||||
Return HeavySelect2Mixin.
|
||||
|
||||
:param data_view: url pattern name
|
||||
:type data_view: str
|
||||
:param data_url: url
|
||||
:type data_url: str
|
||||
:return:
|
||||
Args:
|
||||
data_view (str): URL pattern name
|
||||
data_url (str): URL
|
||||
|
||||
"""
|
||||
self.data_view = kwargs.pop('data_view', None)
|
||||
self.data_url = kwargs.pop('data_url', None)
|
||||
|
|
@ -301,14 +300,12 @@ class ModelSelect2Mixin(object):
|
|||
"""
|
||||
Overwrite class parameters if passed as keyword arguments.
|
||||
|
||||
:param model: model to select choices from
|
||||
:type model: django.db.models.Model
|
||||
:param queryset: queryset to select choices from
|
||||
:type queryset: django.db.models.query.QuerySet
|
||||
:param search_fields: list of model lookup strings
|
||||
:type search_fields: list
|
||||
:param max_results: max. JsonResponse view page size
|
||||
:type max_results: int
|
||||
Args:
|
||||
model (django.db.models.Model): Model to select choices from.
|
||||
queryset (django.db.models.QuerySet): QuerySet to select choices from.
|
||||
search_fields (list): List of model lookup strings.
|
||||
max_results (int): Max. JsonResponse view page size.
|
||||
|
||||
"""
|
||||
self.model = kwargs.pop('model', self.model)
|
||||
self.queryset = kwargs.pop('queryset', self.queryset)
|
||||
|
|
@ -339,12 +336,14 @@ class ModelSelect2Mixin(object):
|
|||
|
||||
def filter_queryset(self, term, queryset=None):
|
||||
"""
|
||||
Return queryset filtered by search_fields matching the passed term.
|
||||
Return QuerySet filtered by search_fields matching the passed term.
|
||||
|
||||
Args:
|
||||
term (str): Search term
|
||||
|
||||
Returns:
|
||||
QuerySet: Filtered QuerySet
|
||||
|
||||
:param term: Search term
|
||||
:type term: str
|
||||
:return: Filtered queryset
|
||||
:rtype: :class:`.django.db.models.QuerySet`
|
||||
"""
|
||||
if queryset is None:
|
||||
queryset = self.get_queryset()
|
||||
|
|
@ -359,10 +358,11 @@ class ModelSelect2Mixin(object):
|
|||
|
||||
def get_queryset(self):
|
||||
"""
|
||||
Return queryset based on :attr:`.queryset` or :attr:`.model`.
|
||||
Return QuerySet based on :attr:`.queryset` or :attr:`.model`.
|
||||
|
||||
Returns:
|
||||
QuerySet: QuerySet of available choices.
|
||||
|
||||
:return: queryset of available choices
|
||||
:rtype: :class:`.django.db.models.QuerySet`
|
||||
"""
|
||||
if self.queryset is not None:
|
||||
queryset = self.queryset
|
||||
|
|
@ -414,10 +414,12 @@ class ModelSelect2Mixin(object):
|
|||
def label_from_instance(obj):
|
||||
return force_text(obj.title).upper()
|
||||
|
||||
:param obj: Instance of django model.
|
||||
:type obj: django.db.models.Model
|
||||
:return Option label.
|
||||
:rtype: str
|
||||
Args:
|
||||
obj (django.db.models.Model): Instance of Django Model.
|
||||
|
||||
Returns:
|
||||
str: Option label.
|
||||
|
||||
"""
|
||||
return force_text(obj)
|
||||
|
||||
|
|
|
|||
|
|
@ -62,10 +62,12 @@ class AutoResponseView(BaseListView):
|
|||
"""
|
||||
Get and return widget from cache.
|
||||
|
||||
Raises a 404 if the widget can not be found or no id is provided.
|
||||
Raises:
|
||||
Http404: If if the widget can not be found or no id is provided.
|
||||
|
||||
Returns:
|
||||
ModelSelect2Mixin: Widget from cache.
|
||||
|
||||
:raises: Http404
|
||||
:return: ModelSelect2Mixin
|
||||
"""
|
||||
field_id = self.kwargs.get('field_id', self.request.GET.get('field_id', None))
|
||||
if not field_id:
|
||||
|
|
|
|||
|
|
@ -41,7 +41,13 @@ sys.path.insert(0, os.path.abspath('..'))
|
|||
|
||||
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode']
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.inheritance_diagram',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx.ext.viewcode',
|
||||
]
|
||||
|
||||
intersphinx_mapping = {
|
||||
'python': ('http://docs.python.org/3.5', None),
|
||||
|
|
|
|||
Loading…
Reference in a new issue