magic-removal: Merged to [2343]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2344 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6589992a38
commit
77a0a9498f
1
AUTHORS
1
AUTHORS
|
@ -61,6 +61,7 @@ answer newbie questions, and generally made Django that much better:
|
|||
Robert Rock Howard <http://djangomojo.com/>
|
||||
Jason Huggins <http://www.jrandolph.com/blog/>
|
||||
Michael Josephson <http://www.sdjournal.com/>
|
||||
junzhang.jn@gmail.com
|
||||
Russell Keith-Magee <freakboy@iinet.net.au>
|
||||
Garth Kidd <http://www.deadlybloodyserious.com/>
|
||||
Sune Kirkeby <http://ibofobi.dk/>
|
||||
|
|
|
@ -33,9 +33,17 @@ class Feed:
|
|||
except AttributeError:
|
||||
return default
|
||||
if callable(attr):
|
||||
try:
|
||||
# Check func_code.co_argcount rather than try/excepting the
|
||||
# function and catching the TypeError, because something inside
|
||||
# the function may raise the TypeError. This technique is more
|
||||
# accurate.
|
||||
if hasattr(attr, 'func_code'):
|
||||
argcount = attr.func_code.co_argcount
|
||||
else:
|
||||
argcount = attr.__call__.func_code.co_argcount
|
||||
if argcount == 2: # one argument is 'self'
|
||||
return attr(obj)
|
||||
except TypeError:
|
||||
else:
|
||||
return attr()
|
||||
return attr
|
||||
|
||||
|
|
|
@ -311,10 +311,9 @@ class ForeignKey(RelatedField, Field):
|
|||
to_name = to._meta.object_name.lower()
|
||||
except AttributeError: # to._meta doesn't exist, so it must be RECURSIVE_RELATIONSHIP_CONSTANT
|
||||
assert isinstance(to, basestring), "ForeignKey(%r) is invalid. First parameter to ForeignKey must be either a model, a model name, or the string %r" % (to, RECURSIVE_RELATIONSHIP_CONSTANT)
|
||||
kwargs['verbose_name'] = kwargs.get('verbose_name', '')
|
||||
else:
|
||||
to_field = to_field or to._meta.pk.name
|
||||
kwargs['verbose_name'] = kwargs.get('verbose_name', to._meta.verbose_name)
|
||||
kwargs['verbose_name'] = kwargs.get('verbose_name', '')
|
||||
|
||||
if kwargs.has_key('edit_inline_type'):
|
||||
import warnings
|
||||
|
|
Loading…
Reference in New Issue