commit
ef348b5298
|
@ -276,7 +276,7 @@ class BaseModelAdmin(six.with_metaclass(RenameBaseModelAdminMethods)):
|
||||||
parts.pop()
|
parts.pop()
|
||||||
|
|
||||||
# Special case -- foo__id__exact and foo__id queries are implied
|
# Special case -- foo__id__exact and foo__id queries are implied
|
||||||
# if foo has been specificially included in the lookup list; so
|
# if foo has been specifically included in the lookup list; so
|
||||||
# drop __id if it is the last part. However, first we need to find
|
# drop __id if it is the last part. However, first we need to find
|
||||||
# the pk attribute name.
|
# the pk attribute name.
|
||||||
rel_name = None
|
rel_name = None
|
||||||
|
@ -284,7 +284,7 @@ class BaseModelAdmin(six.with_metaclass(RenameBaseModelAdminMethods)):
|
||||||
try:
|
try:
|
||||||
field, _, _, _ = model._meta.get_field_by_name(part)
|
field, _, _, _ = model._meta.get_field_by_name(part)
|
||||||
except FieldDoesNotExist:
|
except FieldDoesNotExist:
|
||||||
# Lookups on non-existants fields are ok, since they're ignored
|
# Lookups on non-existent fields are ok, since they're ignored
|
||||||
# later.
|
# later.
|
||||||
return True
|
return True
|
||||||
if hasattr(field, 'rel'):
|
if hasattr(field, 'rel'):
|
||||||
|
@ -306,7 +306,7 @@ class BaseModelAdmin(six.with_metaclass(RenameBaseModelAdminMethods)):
|
||||||
def has_add_permission(self, request):
|
def has_add_permission(self, request):
|
||||||
"""
|
"""
|
||||||
Returns True if the given request has permission to add an object.
|
Returns True if the given request has permission to add an object.
|
||||||
Can be overriden by the user in subclasses.
|
Can be overridden by the user in subclasses.
|
||||||
"""
|
"""
|
||||||
opts = self.opts
|
opts = self.opts
|
||||||
return request.user.has_perm(opts.app_label + '.' + opts.get_add_permission())
|
return request.user.has_perm(opts.app_label + '.' + opts.get_add_permission())
|
||||||
|
@ -317,7 +317,7 @@ class BaseModelAdmin(six.with_metaclass(RenameBaseModelAdminMethods)):
|
||||||
Django model instance, the default implementation doesn't examine the
|
Django model instance, the default implementation doesn't examine the
|
||||||
`obj` parameter.
|
`obj` parameter.
|
||||||
|
|
||||||
Can be overriden by the user in subclasses. In such case it should
|
Can be overridden by the user in subclasses. In such case it should
|
||||||
return True if the given request has permission to change the `obj`
|
return True if the given request has permission to change the `obj`
|
||||||
model instance. If `obj` is None, this should return True if the given
|
model instance. If `obj` is None, this should return True if the given
|
||||||
request has permission to change *any* object of the given type.
|
request has permission to change *any* object of the given type.
|
||||||
|
@ -331,7 +331,7 @@ class BaseModelAdmin(six.with_metaclass(RenameBaseModelAdminMethods)):
|
||||||
Django model instance, the default implementation doesn't examine the
|
Django model instance, the default implementation doesn't examine the
|
||||||
`obj` parameter.
|
`obj` parameter.
|
||||||
|
|
||||||
Can be overriden by the user in subclasses. In such case it should
|
Can be overridden by the user in subclasses. In such case it should
|
||||||
return True if the given request has permission to delete the `obj`
|
return True if the given request has permission to delete the `obj`
|
||||||
model instance. If `obj` is None, this should return True if the given
|
model instance. If `obj` is None, this should return True if the given
|
||||||
request has permission to delete *any* object of the given type.
|
request has permission to delete *any* object of the given type.
|
||||||
|
@ -601,7 +601,7 @@ class ModelAdmin(BaseModelAdmin):
|
||||||
Return a dictionary mapping the names of all actions for this
|
Return a dictionary mapping the names of all actions for this
|
||||||
ModelAdmin to a tuple of (callable, name, description) for each action.
|
ModelAdmin to a tuple of (callable, name, description) for each action.
|
||||||
"""
|
"""
|
||||||
# If self.actions is explicitally set to None that means that we don't
|
# If self.actions is explicitly set to None that means that we don't
|
||||||
# want *any* actions enabled on this page.
|
# want *any* actions enabled on this page.
|
||||||
from django.contrib.admin.views.main import IS_POPUP_VAR
|
from django.contrib.admin.views.main import IS_POPUP_VAR
|
||||||
if self.actions is None or IS_POPUP_VAR in request.GET:
|
if self.actions is None or IS_POPUP_VAR in request.GET:
|
||||||
|
|
|
@ -129,7 +129,7 @@ class AdminSite(object):
|
||||||
|
|
||||||
def get_action(self, name):
|
def get_action(self, name):
|
||||||
"""
|
"""
|
||||||
Explicitally get a registered global action wheather it's enabled or
|
Explicitly get a registered global action whether it's enabled or
|
||||||
not. Raises KeyError for invalid names.
|
not. Raises KeyError for invalid names.
|
||||||
"""
|
"""
|
||||||
return self._global_actions[name]
|
return self._global_actions[name]
|
||||||
|
|
|
@ -911,7 +911,7 @@ class Model(six.with_metaclass(ModelBase)):
|
||||||
def full_clean(self, exclude=None):
|
def full_clean(self, exclude=None):
|
||||||
"""
|
"""
|
||||||
Calls clean_fields, clean, and validate_unique, on the model,
|
Calls clean_fields, clean, and validate_unique, on the model,
|
||||||
and raises a ``ValidationError`` for any errors that occured.
|
and raises a ``ValidationError`` for any errors that occurred.
|
||||||
"""
|
"""
|
||||||
errors = {}
|
errors = {}
|
||||||
if exclude is None:
|
if exclude is None:
|
||||||
|
|
|
@ -118,7 +118,7 @@ class BaseFormSet(object):
|
||||||
if self.is_bound:
|
if self.is_bound:
|
||||||
return self.management_form.cleaned_data[INITIAL_FORM_COUNT]
|
return self.management_form.cleaned_data[INITIAL_FORM_COUNT]
|
||||||
else:
|
else:
|
||||||
# Use the length of the inital data if it's there, 0 otherwise.
|
# Use the length of the initial data if it's there, 0 otherwise.
|
||||||
initial_forms = self.initial and len(self.initial) or 0
|
initial_forms = self.initial and len(self.initial) or 0
|
||||||
return initial_forms
|
return initial_forms
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ def parse_html(html):
|
||||||
"""
|
"""
|
||||||
Takes a string that contains *valid* HTML and turns it into a Python object
|
Takes a string that contains *valid* HTML and turns it into a Python object
|
||||||
structure that can be easily compared against other HTML on semantic
|
structure that can be easily compared against other HTML on semantic
|
||||||
equivilance. Syntactical differences like which quotation is used on
|
equivalence. Syntactical differences like which quotation is used on
|
||||||
arguments will be ignored.
|
arguments will be ignored.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -217,7 +217,7 @@ def parse_etags(etag_str):
|
||||||
|
|
||||||
def quote_etag(etag):
|
def quote_etag(etag):
|
||||||
"""
|
"""
|
||||||
Wraps a string in double quotes escaping contents as necesary.
|
Wraps a string in double quotes escaping contents as necessary.
|
||||||
"""
|
"""
|
||||||
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
|
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,7 @@ class DjangoHTMLTranslator(SmartyPantsHTMLTranslator):
|
||||||
# which is a bit less obvious that I'd like.
|
# which is a bit less obvious that I'd like.
|
||||||
#
|
#
|
||||||
# FIXME: these messages are all hardcoded in English. We need to change
|
# FIXME: these messages are all hardcoded in English. We need to change
|
||||||
# that to accomodate other language docs, but I can't work out how to make
|
# that to accommodate other language docs, but I can't work out how to make
|
||||||
# that work.
|
# that work.
|
||||||
#
|
#
|
||||||
version_text = {
|
version_text = {
|
||||||
|
|
|
@ -110,7 +110,7 @@ def fixliterals(fname):
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following is taken from django.utils.termcolors and is copied here to
|
# The following is taken from django.utils.termcolors and is copied here to
|
||||||
# avoid the dependancy.
|
# avoid the dependency.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue