Browse files

newforms: Implemented formfield() for database OneToOneField class. N…

…ot sure about this one, but one-to-one fields are eventually going to be refactored so it's not a big deal if it doesn't work

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent 6a75c8a commit 016d75cc7fab107e8116211b5091d781a3bf0d24 @adrianholovaty adrianholovaty committed Dec 27, 2006
Showing with 3 additions and 0 deletions.
  1. +3 −0 django/db/models/fields/
3 django/db/models/fields/
@@ -612,6 +612,9 @@ def contribute_to_related_class(self, cls, related):
if not cls._meta.one_to_one_field:
cls._meta.one_to_one_field = self
+ def formfield(self):
+ return forms.ChoiceField(choices=self.get_choices_default(), required=not self.blank, label=capfirst(self.verbose_name))
class ManyToManyField(RelatedField, Field):
def __init__(self, to, **kwargs):
kwargs['verbose_name'] = kwargs.get('verbose_name', None)

0 comments on commit 016d75c

Please sign in to comment.