From d25d6b3f86b3a53306ab144596dbe8e5d96aa112 Mon Sep 17 00:00:00 2001 From: Joseph Kocherhans Date: Sun, 2 Dec 2007 20:41:27 +0000 Subject: [PATCH] Added PendingDeprecationWarmings for form_for_instance/form_for_model. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6846 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/newforms/models.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/django/newforms/models.py b/django/newforms/models.py index 77b2b321e4d..4eb61761a1f 100644 --- a/django/newforms/models.py +++ b/django/newforms/models.py @@ -3,6 +3,8 @@ Helper functions for creating Form classes from Django models and database field objects. """ +from warnings import warn + from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import smart_unicode from django.utils.datastructures import SortedDict @@ -82,6 +84,9 @@ def form_for_model(model, form=BaseForm, fields=None, determining the formfield for a given database field. It's a callable that takes a database Field instance and returns a form Field instance. """ + warn("form_for_model is deprecated, use ModelForm instead.", + PendingDeprecationWarning, + stacklevel=3) opts = model._meta field_list = [] for f in opts.fields + opts.many_to_many: @@ -109,6 +114,9 @@ def form_for_instance(instance, form=BaseForm, fields=None, takes a database Field instance, plus **kwargs, and returns a form Field instance with the given kwargs (i.e. 'initial'). """ + warn("form_for_instance is deprecated, use ModelForm instead.", + PendingDeprecationWarning, + stacklevel=3) model = instance.__class__ opts = model._meta field_list = []