mirror of
https://github.com/django/django.git
synced 2025-07-05 10:19:20 +00:00
Fixed auto_now_add weird editable behaviour.
git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@1244 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
69006c3721
commit
11a4288a08
Binary file not shown.
Binary file not shown.
@ -210,6 +210,7 @@ def items_for_result(cl, result):
|
|||||||
if first: # First column is a special case
|
if first: # First column is a special case
|
||||||
first = False
|
first = False
|
||||||
url = cl.url_for_result(result)
|
url = cl.url_for_result(result)
|
||||||
|
result_id = getattr(result, pk)
|
||||||
yield ('<th%s><a href="%s"%s>%s</a></th>' % \
|
yield ('<th%s><a href="%s"%s>%s</a></th>' % \
|
||||||
(row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr))
|
(row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %r); return false;"' % result_id or ''), result_repr))
|
||||||
else:
|
else:
|
||||||
|
@ -109,6 +109,7 @@ class FormWrapper:
|
|||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
for field in self.manipulator.fields:
|
for field in self.manipulator.fields:
|
||||||
|
|
||||||
if field.field_name == key:
|
if field.field_name == key:
|
||||||
data = field.extract_data(self.data)
|
data = field.extract_data(self.data)
|
||||||
return FormFieldWrapper(field, data, self.error_dict.get(field.field_name, []))
|
return FormFieldWrapper(field, data, self.error_dict.get(field.field_name, []))
|
||||||
@ -117,8 +118,7 @@ class FormWrapper:
|
|||||||
for inline_collection in self._inline_collections:
|
for inline_collection in self._inline_collections:
|
||||||
if inline_collection.name == key:
|
if inline_collection.name == key:
|
||||||
return inline_collection
|
return inline_collection
|
||||||
|
raise KeyError("Could not find Formfield or InlineObjectCollection named:%s" % key )
|
||||||
raise KeyError
|
|
||||||
|
|
||||||
def fill_inline_collections(self):
|
def fill_inline_collections(self):
|
||||||
if not self._inline_collections:
|
if not self._inline_collections:
|
||||||
|
@ -402,6 +402,13 @@ class DateField(Field):
|
|||||||
return datetime.datetime.now()
|
return datetime.datetime.now()
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
# Needed because of horrible auto_now[_add] behaviour wrt. editable
|
||||||
|
def get_follow(self, override=None):
|
||||||
|
if override != None:
|
||||||
|
return override
|
||||||
|
else:
|
||||||
|
return self.editable or self.auto_now or self.auto_now_add
|
||||||
|
|
||||||
def get_db_prep_save(self, value):
|
def get_db_prep_save(self, value):
|
||||||
# Casts dates into string format for entry into database.
|
# Casts dates into string format for entry into database.
|
||||||
if value is not None:
|
if value is not None:
|
||||||
@ -860,8 +867,6 @@ class BoundFieldLine(object):
|
|||||||
for bound_field in self.bound_fields:
|
for bound_field in self.bound_fields:
|
||||||
yield bound_field
|
yield bound_field
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return "%s:(%s)" % (self.__class__.__name__, self.bound_fields)
|
|
||||||
|
|
||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.bound_fields)
|
return len(self.bound_fields)
|
||||||
@ -889,8 +894,6 @@ class BoundFieldSet(object):
|
|||||||
self.classes = field_set.classes
|
self.classes = field_set.classes
|
||||||
self.bound_field_lines = [ field_line.bind(field_mapping,original, bound_field_line_class)
|
self.bound_field_lines = [ field_line.bind(field_mapping,original, bound_field_line_class)
|
||||||
for field_line in field_set]
|
for field_line in field_set]
|
||||||
def __repr__(self):
|
|
||||||
return "%s:(%s,%s)" % (self.__class__.__name__, self.name, self.bound_field_lines)
|
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for bound_field_line in self.bound_field_lines:
|
for bound_field_line in self.bound_field_lines:
|
||||||
|
@ -826,7 +826,6 @@ class DebugNodeList(NodeList):
|
|||||||
e.source = node.source
|
e.source = node.source
|
||||||
raise
|
raise
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
||||||
from traceback import extract_tb, format_list, format_exception_only
|
from traceback import extract_tb, format_list, format_exception_only
|
||||||
from sys import exc_info
|
from sys import exc_info
|
||||||
t,v,tb = exc_info()
|
t,v,tb = exc_info()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user