mirror of
https://github.com/django/django.git
synced 2025-06-13 07:29:13 +00:00
magic-removal: first step to integrate mutually referential models
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1702 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f4dfb99f45
commit
356de17636
@ -16,15 +16,12 @@ HORIZONTAL, VERTICAL = 1, 2
|
|||||||
BLANK_CHOICE_DASH = [("", "---------")]
|
BLANK_CHOICE_DASH = [("", "---------")]
|
||||||
BLANK_CHOICE_NONE = [("", "None")]
|
BLANK_CHOICE_NONE = [("", "None")]
|
||||||
|
|
||||||
|
|
||||||
# prepares a value for use in a LIKE query
|
# prepares a value for use in a LIKE query
|
||||||
prep_for_like_query = lambda x: str(x).replace("%", "\%").replace("_", "\_")
|
prep_for_like_query = lambda x: str(x).replace("%", "\%").replace("_", "\_")
|
||||||
|
|
||||||
# returns the <ul> class for a given radio_admin value
|
# returns the <ul> class for a given radio_admin value
|
||||||
get_ul_class = lambda x: 'radiolist%s' % ((x == HORIZONTAL) and ' inline' or '')
|
get_ul_class = lambda x: 'radiolist%s' % ((x == HORIZONTAL) and ' inline' or '')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def manipulator_valid_rel_key(f, self, field_data, all_data):
|
def manipulator_valid_rel_key(f, self, field_data, all_data):
|
||||||
"Validates that the value is a valid foreign key"
|
"Validates that the value is a valid foreign key"
|
||||||
klass = f.rel.to
|
klass = f.rel.to
|
||||||
|
@ -34,7 +34,7 @@ class RelatedField(object):
|
|||||||
if isinstance(other, basestring):
|
if isinstance(other, basestring):
|
||||||
if other == RECURSIVE_RELATIONSHIP_CONSTANT:
|
if other == RECURSIVE_RELATIONSHIP_CONSTANT:
|
||||||
self.rel.to = cls.__name__
|
self.rel.to = cls.__name__
|
||||||
self.add_lookup(cls, self)
|
self.add_lookup(cls, self)
|
||||||
else:
|
else:
|
||||||
self.do_related_class(other, cls)
|
self.do_related_class(other, cls)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user