summaryrefslogtreecommitdiff
path: root/django/newforms
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2007-12-02 18:40:34 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2007-12-02 18:40:34 +0000
commit22aa9db4a22d848011775af7007d3c1f8772e056 (patch)
treed0e7f99af5ed6f650fa592874a2afdefe72513e0 /django/newforms
parentd326b6f6032b5248912ce48edeaa57266b22538e (diff)
newforms-admin: Made some _meta lookups more direct.
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6842 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/newforms')
-rw-r--r--django/newforms/models.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/django/newforms/models.py b/django/newforms/models.py
index 671d7b14da..fdb1285f6f 100644
--- a/django/newforms/models.py
+++ b/django/newforms/models.py
@@ -28,7 +28,7 @@ def save_instance(form, instance, fields=None, fail_message='saved',
database. Returns ``instance``.
"""
from django.db import models
- opts = instance.__class__._meta
+ opts = instance._meta
if form.errors:
raise ValueError("The %s could not be %s because the data didn't"
" validate." % (opts.object_name, fail_message))
@@ -42,7 +42,7 @@ def save_instance(form, instance, fields=None, fail_message='saved',
f.save_form_data(instance, cleaned_data[f.name])
# Wrap up the saving of m2m data as a function.
def save_m2m():
- opts = instance.__class__._meta
+ opts = instance._meta
cleaned_data = form.cleaned_data
for f in opts.many_to_many:
if fields and f.name not in fields:
@@ -256,8 +256,7 @@ def initial_data(instance, fields=None):
"""
# avoid a circular import
from django.db.models.fields.related import ManyToManyField
- model = instance.__class__
- opts = model._meta
+ opts = instance._meta
initial = {}
for f in opts.fields + opts.many_to_many:
if not f.editable: