summaryrefslogtreecommitdiff
path: root/django/db/models
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-12-15 05:46:11 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-12-15 05:46:11 +0000
commit6001974e4501d7d8a7fcdfb11776bfb81d024754 (patch)
tree6e1cfb9b9f059e84414a7773149dce28b6761570 /django/db/models
parent0a7d8b18ff844edad75ac3b21fb89e479db4705a (diff)
newforms: Added initial implementation of form_for_model and form_for_fields
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models')
-rw-r--r--django/db/models/fields/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 8e8d68aad5..1927ad7535 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -333,6 +333,12 @@ class Field(object):
return self._choices
choices = property(_get_choices)
+ def formfield(self):
+ "Returns a django.newforms.Field instance for this database Field."
+ from django.newforms import CharField
+ # TODO: This is just a temporary default during development.
+ return CharField(label=capfirst(self.verbose_name))
+
class AutoField(Field):
empty_strings_allowed = False
def __init__(self, *args, **kwargs):