Fixed #1213 -- Changed value of NOT_PROVIDED so that it's not a string, to prevent possible (but highly unlikely) collisions. Thanks, akaihola
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2454 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
6330e286c3
commit
6d9f4e4ef6
|
@ -6,8 +6,8 @@ from django.utils.text import capfirst
|
|||
from django.utils.translation import gettext_lazy, ngettext
|
||||
import datetime, os
|
||||
|
||||
# Random entropy string used by "default" param.
|
||||
NOT_PROVIDED = 'oijpwojefiojpanv'
|
||||
class NOT_PROVIDED:
|
||||
pass
|
||||
|
||||
# Values for filter_interface.
|
||||
HORIZONTAL, VERTICAL = 1, 2
|
||||
|
@ -193,11 +193,11 @@ class Field(object):
|
|||
|
||||
def has_default(self):
|
||||
"Returns a boolean of whether this field has a default value."
|
||||
return self.default != NOT_PROVIDED
|
||||
return self.default is not NOT_PROVIDED
|
||||
|
||||
def get_default(self):
|
||||
"Returns the default value for this field."
|
||||
if self.default != NOT_PROVIDED:
|
||||
if self.default is not NOT_PROVIDED:
|
||||
if hasattr(self.default, '__get_value__'):
|
||||
return self.default.__get_value__()
|
||||
return self.default
|
||||
|
|
Loading…
Reference in New Issue