mirror of
https://github.com/Hopiu/django-select2.git
synced 2026-05-18 18:01:06 +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.
|
Return HeavySelect2Mixin.
|
||||||
|
|
||||||
:param data_view: url pattern name
|
Args:
|
||||||
:type data_view: str
|
data_view (str): URL pattern name
|
||||||
:param data_url: url
|
data_url (str): URL
|
||||||
:type data_url: str
|
|
||||||
:return:
|
|
||||||
"""
|
"""
|
||||||
self.data_view = kwargs.pop('data_view', None)
|
self.data_view = kwargs.pop('data_view', None)
|
||||||
self.data_url = kwargs.pop('data_url', None)
|
self.data_url = kwargs.pop('data_url', None)
|
||||||
|
|
@ -301,14 +300,12 @@ class ModelSelect2Mixin(object):
|
||||||
"""
|
"""
|
||||||
Overwrite class parameters if passed as keyword arguments.
|
Overwrite class parameters if passed as keyword arguments.
|
||||||
|
|
||||||
:param model: model to select choices from
|
Args:
|
||||||
:type model: django.db.models.Model
|
model (django.db.models.Model): Model to select choices from.
|
||||||
:param queryset: queryset to select choices from
|
queryset (django.db.models.QuerySet): QuerySet to select choices from.
|
||||||
:type queryset: django.db.models.query.QuerySet
|
search_fields (list): List of model lookup strings.
|
||||||
:param search_fields: list of model lookup strings
|
max_results (int): Max. JsonResponse view page size.
|
||||||
:type search_fields: list
|
|
||||||
:param max_results: max. JsonResponse view page size
|
|
||||||
:type max_results: int
|
|
||||||
"""
|
"""
|
||||||
self.model = kwargs.pop('model', self.model)
|
self.model = kwargs.pop('model', self.model)
|
||||||
self.queryset = kwargs.pop('queryset', self.queryset)
|
self.queryset = kwargs.pop('queryset', self.queryset)
|
||||||
|
|
@ -339,12 +336,14 @@ class ModelSelect2Mixin(object):
|
||||||
|
|
||||||
def filter_queryset(self, term, queryset=None):
|
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:
|
if queryset is None:
|
||||||
queryset = self.get_queryset()
|
queryset = self.get_queryset()
|
||||||
|
|
@ -359,10 +358,11 @@ class ModelSelect2Mixin(object):
|
||||||
|
|
||||||
def get_queryset(self):
|
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:
|
if self.queryset is not None:
|
||||||
queryset = self.queryset
|
queryset = self.queryset
|
||||||
|
|
@ -414,10 +414,12 @@ class ModelSelect2Mixin(object):
|
||||||
def label_from_instance(obj):
|
def label_from_instance(obj):
|
||||||
return force_text(obj.title).upper()
|
return force_text(obj.title).upper()
|
||||||
|
|
||||||
:param obj: Instance of django model.
|
Args:
|
||||||
:type obj: django.db.models.Model
|
obj (django.db.models.Model): Instance of Django Model.
|
||||||
:return Option label.
|
|
||||||
:rtype: str
|
Returns:
|
||||||
|
str: Option label.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return force_text(obj)
|
return force_text(obj)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,12 @@ class AutoResponseView(BaseListView):
|
||||||
"""
|
"""
|
||||||
Get and return widget from cache.
|
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))
|
field_id = self.kwargs.get('field_id', self.request.GET.get('field_id', None))
|
||||||
if not field_id:
|
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
|
# Add any Sphinx extension module names here, as strings. They can be extensions
|
||||||
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
# 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 = {
|
intersphinx_mapping = {
|
||||||
'python': ('http://docs.python.org/3.5', None),
|
'python': ('http://docs.python.org/3.5', None),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue