Index: django/core/meta/__init__.py
===================================================================
--- django/core/meta/__init__.py	(revision 992)
+++ django/core/meta/__init__.py	(working copy)
@@ -153,6 +153,9 @@
         exceptions=None, permissions=None, get_latest_by=None,
         order_with_respect_to=None, module_constants=None):
 
+        #jgd
+        #print "initing Options for " + verbose_name
+        
         # Save the original function args, for use by copy(). Note that we're
         # NOT using copy.deepcopy(), because that would create a new copy of
         # everything in memory, and it's better to conserve memory. Of course,
@@ -209,6 +212,13 @@
             if f.primary_key:
                 self.pk = f
                 break
+        #jgd
+        #if self.pk:
+        #  print "found pk " + self.pk.name
+        #  if self.pk.db_column:
+        #    print "col " + self.pk.db_column
+        #else:
+        #  print "didn't find pk"
         # If a primary_key field hasn't been specified, add an
         # auto-incrementing primary-key ID field automatically.
         if self.pk is None:
@@ -408,6 +418,7 @@
         # Gather all attributes that are Field instances.
         fields = []
         for obj_name, obj in attrs.items():
+            print "field: " + obj_name
             if isinstance(obj, Field):
                 obj.set_name(obj_name)
                 fields.append(obj)
@@ -760,17 +771,23 @@
                             val = getattr(rel_obj, f.rel.field_name)
                         except AttributeError:
                             raise TypeError, "Invalid value: %r should be a %s instance, not a %s" % (f.name, f.rel.to, type(rel_obj))
-                setattr(self, f.column, val)
+                #jgd
+                #setattr(self, f.column, val)
+                setattr(self, f.name, val)
             else:
                 val = kwargs.pop(f.name, f.get_default())
                 setattr(self, f.name, val)
         if kwargs:
             raise TypeError, "'%s' is an invalid keyword argument for this function" % kwargs.keys()[0]
     for i, arg in enumerate(args):
-        setattr(self, opts.fields[i].column, arg)
+        #jgd
+        #setattr(self, opts.fields[i].column, arg)
+        setattr(self, opts.fields[i].name, arg)
 
 def method_eq(opts, self, other):
-    return isinstance(other, self.__class__) and getattr(self, opts.pk.column) == getattr(other, opts.pk.column)
+    #jgd
+    #return isinstance(other, self.__class__) and getattr(self, opts.pk.column) == getattr(other, opts.pk.column)
+    return isinstance(other, self.__class__) and getattr(self, opts.pk.name) == getattr(other, opts.pk.name)
 
 def method_save(opts, self):
     # Run any pre-save hooks.
@@ -779,42 +796,62 @@
     non_pks = [f for f in opts.fields if not f.primary_key]
     cursor = db.db.cursor()
 
+    #jgd
+    #print "saving"
     # First, try an UPDATE. If that doesn't update anything, do an INSERT.
-    pk_val = getattr(self, opts.pk.column)
+    #jgd
+    #pk_val = getattr(self, opts.pk.column)
+    pk_val = getattr(self, opts.pk.name)
     pk_set = bool(pk_val)
     record_exists = True
     if pk_set:
+        #jgd
+        #print "pk set"
         # Determine whether a record with the primary key already exists.
         cursor.execute("SELECT 1 FROM %s WHERE %s=%%s LIMIT 1" % (opts.db_table, opts.pk.column), [pk_val])
         # If it does already exist, do an UPDATE.
         if cursor.fetchone():
-            db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.column), False)) for f in non_pks]
+            #jgd
+            #db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.column), False)) for f in non_pks]
+            db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.name), False)) for f in non_pks]
             cursor.execute("UPDATE %s SET %s WHERE %s=%%s" % (opts.db_table,
                 ','.join(['%s=%%s' % f.column for f in non_pks]), opts.pk.column),
                 db_values + [pk_val])
         else:
             record_exists = False
     if not pk_set or not record_exists:
+        #jgd
+        #print "pk not set"
+        #jgd
         field_names = [f.column for f in opts.fields if not isinstance(f, AutoField)]
+        #>field_names = [f.name for f in opts.fields if not isinstance(f, AutoField)]
         placeholders = ['%s'] * len(field_names)
-        db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.column), True)) for f in opts.fields if not isinstance(f, AutoField)]
+        #jgd
+        #<db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.column), True)) for f in opts.fields if not isinstance(f, AutoField)]
+        db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.name), True)) for f in opts.fields if not isinstance(f, AutoField)]
         if opts.order_with_respect_to:
             field_names.append('_order')
             # TODO: This assumes the database supports subqueries.
             placeholders.append('(SELECT COUNT(*) FROM %s WHERE %s = %%s)' % \
                 (opts.db_table, opts.order_with_respect_to.column))
-            db_values.append(getattr(self, opts.order_with_respect_to.column))
+            #jgd
+            #db_values.append(getattr(self, opts.order_with_respect_to.column))
+            db_values.append(getattr(self, opts.order_with_respect_to.name))
         cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % (opts.db_table,
             ','.join(field_names), ','.join(placeholders)), db_values)
         if opts.has_auto_field:
-            setattr(self, opts.pk.column, db.get_last_insert_id(cursor, opts.db_table, opts.pk.column))
+            #jgd
+            #setattr(self, opts.pk.column, db.get_last_insert_id(cursor, opts.db_table, opts.pk.column))
+            setattr(self, opts.pk.name, db.get_last_insert_id(cursor, opts.db_table, opts.pk.column))
     db.db.commit()
     # Run any post-save hooks.
     if hasattr(self, '_post_save'):
         self._post_save()
 
 def method_delete(opts, self):
-    assert getattr(self, opts.pk.column) is not None, "%r can't be deleted because it doesn't have an ID."
+    #jgd
+    #assert getattr(self, opts.pk.column) is not None, "%r can't be deleted because it doesn't have an ID."
+    assert getattr(self, opts.pk.name) is not None, "%r can't be deleted because it doesn't have an ID."
     # Run any pre-delete hooks.
     if hasattr(self, '_pre_delete'):
         self._pre_delete()
@@ -832,16 +869,30 @@
             for sub_obj in getattr(self, 'get_%s_list' % rel_opts_name)():
                 sub_obj.delete()
     for rel_opts, rel_field in opts.get_all_related_many_to_many_objects():
+        #jgd
+        #cursor.execute("DELETE FROM %s WHERE %s_id=%%s" % (rel_field.get_m2m_db_table(rel_opts),
+        #    self._meta.object_name.lower()), [getattr(self, opts.pk.column)])
         cursor.execute("DELETE FROM %s WHERE %s_id=%%s" % (rel_field.get_m2m_db_table(rel_opts),
-            self._meta.object_name.lower()), [getattr(self, opts.pk.column)])
+            self._meta.object_name.lower()), [getattr(self, opts.pk.name)])
+        
     for f in opts.many_to_many:
+        #jgd
+        #cursor.execute("DELETE FROM %s WHERE %s_id=%%s" % (f.get_m2m_db_table(opts), self._meta.object_name.lower()),
+        #    [getattr(self, opts.pk.column)])
         cursor.execute("DELETE FROM %s WHERE %s_id=%%s" % (f.get_m2m_db_table(opts), self._meta.object_name.lower()),
-            [getattr(self, opts.pk.column)])
-    cursor.execute("DELETE FROM %s WHERE %s=%%s" % (opts.db_table, opts.pk.column), [getattr(self, opts.pk.column)])
+            [getattr(self, opts.pk.name)])
+        
+    #jgd
+    #cursor.execute("DELETE FROM %s WHERE %s=%%s" % (opts.db_table, opts.pk.column), [getattr(self, opts.pk.column)])
+    cursor.execute("DELETE FROM %s WHERE %s=%%s" % (opts.db_table, opts.pk.column), [getattr(self, opts.pk.name)])
     db.db.commit()
-    setattr(self, opts.pk.column, None)
+    #jgd
+    #setattr(self, opts.pk.column, None)
+    setattr(self, opts.pk.name, None)
     for f in opts.fields:
-        if isinstance(f, FileField) and getattr(self, f.column):
+        #jgd
+        #if isinstance(f, FileField) and getattr(self, f.column):
+        if isinstance(f, FileField) and getattr(self, f.name):
             file_name = getattr(self, 'get_%s_filename' % f.name)()
             # If the file exists and no other object of this type references it,
             # delete it from the filesystem.
@@ -856,7 +907,9 @@
         self._next_in_order_cache = opts.get_model_module().get_object(order_by=('_order',),
             where=['_order > (SELECT _order FROM %s WHERE %s=%%s)' % (opts.db_table, opts.pk.column),
                 '%s=%%s' % order_field.column], limit=1,
-            params=[getattr(self, opts.pk.column), getattr(self, order_field.column)])
+            #jgd
+            #params=[getattr(self, opts.pk.column), getattr(self, order_field.column)])
+            params=[getattr(self, opts.pk.name), getattr(self, order_field.name)])
     return self._next_in_order_cache
 
 def method_get_previous_in_order(opts, order_field, self):
@@ -873,7 +926,9 @@
 def method_get_many_to_one(field_with_rel, self):
     cache_var = field_with_rel.get_cache_name()
     if not hasattr(self, cache_var):
-        val = getattr(self, field_with_rel.column)
+        #jgd
+        #val = getattr(self, field_with_rel.column)
+        val = getattr(self, field_with_rel.name)
         mod = field_with_rel.rel.to.get_model_module()
         if val is None:
             raise getattr(mod, '%sDoesNotExist' % field_with_rel.rel.to.object_name)
@@ -893,7 +948,9 @@
             field_with_rel.get_m2m_db_table(self._meta), rel.pk.column,
             rel.object_name.lower(), self._meta.object_name.lower(), rel.get_order_sql('a'))
         cursor = db.db.cursor()
-        cursor.execute(sql, [getattr(self, self._meta.pk.column)])
+        #jgd
+        #cursor.execute(sql, [getattr(self, self._meta.pk.column)])
+        cursor.execute(sql, [getattr(self, self._meta.pk.name)])
         setattr(self, cache_var, [getattr(mod, rel.object_name)(*row) for row in cursor.fetchall()])
     return getattr(self, cache_var)
 
@@ -914,7 +971,9 @@
     rel = rel_field.rel.to
     m2m_table = rel_field.get_m2m_db_table(self._meta)
     cursor = db.db.cursor()
-    this_id = getattr(self, self._meta.pk.column)
+    #jgd
+    #this_id = getattr(self, self._meta.pk.column)
+    this_id = getattr(self, self._meta.pk.name)
     if ids_to_delete:
         sql = "DELETE FROM %s WHERE %s_id = %%s AND %s_id IN (%s)" % (m2m_table, self._meta.object_name.lower(), rel.object_name.lower(), ','.join(map(str, ids_to_delete)))
         cursor.execute(sql, [this_id])
@@ -954,7 +1013,9 @@
 # Handles related many-to-many object retrieval.
 # Examples: Album.get_song(), Album.get_song_list(), Album.get_song_count()
 def method_get_related_many_to_many(method_name, opts, rel_mod, rel_field, self, **kwargs):
-    kwargs['%s__%s__exact' % (rel_field.name, opts.pk.name)] = getattr(self, opts.pk.column)
+    #jgd
+    #kwargs['%s__%s__exact' % (rel_field.name, opts.pk.name)] = getattr(self, opts.pk.column)
+    kwargs['%s__%s__exact' % (rel_field.name, opts.pk.name)] = getattr(self, opts.pk.name)
     return getattr(rel_mod, method_name)(**kwargs)
 
 # Handles setting many-to-many related objects.
@@ -963,7 +1024,9 @@
     id_list = map(int, id_list) # normalize to integers
     rel = rel_field.rel.to
     m2m_table = rel_field.get_m2m_db_table(rel_opts)
-    this_id = getattr(self, self._meta.pk.column)
+    #jgd
+    #this_id = getattr(self, self._meta.pk.column)
+    this_id = getattr(self, self._meta.pk.name)
     cursor = db.db.cursor()
     cursor.execute("DELETE FROM %s WHERE %s_id = %%s" % (m2m_table, rel.object_name.lower()), [this_id])
     sql = "INSERT INTO %s (%s_id, %s_id) VALUES (%%s, %%s)" % (m2m_table, rel.object_name.lower(), rel_opts.object_name.lower())
@@ -1000,7 +1063,9 @@
 # CHOICE-RELATED METHODS ###################
 
 def method_get_display_value(field, self):
-    value = getattr(self, field.column)
+    #jgd
+    #value = getattr(self, field.column)
+    value = getattr(self, field.name)
     return dict(field.choices).get(value, value)
 
 # FILE-RELATED METHODS #####################
@@ -1151,9 +1216,13 @@
 
     # 'fields' is a list of field names to fetch.
     try:
-        fields = [opts.get_field(f).column for f in kwargs.pop('fields')]
+        #jgd
+        #fields = [opts.get_field(f).column for f in kwargs.pop('fields')]
+        fields = [opts.get_field(f).name for f in kwargs.pop('fields')]
     except KeyError: # Default to all fields.
-        fields = [f.column for f in opts.fields]
+        #jgd
+        #fields = [f.column for f in opts.fields]
+        fields = [f.name for f in opts.fields]
 
     cursor = db.db.cursor()
     _, sql, params = function_get_sql_clause(opts, **kwargs)
@@ -1203,6 +1272,8 @@
     # table_count is used to ensure table aliases are unique.
     tables, join_where, where, params = [], [], [], []
     for kwarg, kwarg_value in kwarg_items:
+        #jgd
+        #print "kw: " + kwarg, kwarg_value
         if kwarg in ('order_by', 'limit', 'offset', 'select_related', 'distinct', 'select', 'tables', 'where', 'params'):
             continue
         if kwarg_value is None:
@@ -1218,17 +1289,25 @@
         lookup_list = kwarg.split(LOOKUP_SEPARATOR)
         # pk="value" is shorthand for (primary key)__exact="value"
         if lookup_list[-1] == 'pk':
+            #jgd
+            #print "looking up pk"
             if opts.pk.rel:
+                #print "pk rel"
                 lookup_list = lookup_list[:-1] + [opts.pk.name, opts.pk.rel.field_name, 'exact']
             else:
+                #print "pk no rel"
                 lookup_list = lookup_list[:-1] + [opts.pk.name, 'exact']
         if len(lookup_list) == 1:
+            #jgd
+            #print "len(lookup_list) == 1"
             _throw_bad_kwarg_error(kwarg)
         lookup_type = lookup_list.pop()
         current_opts = opts # We'll be overwriting this, so keep a reference to the original opts.
         current_table_alias = current_opts.db_table
         param_required = False
         while lookup_list or param_required:
+            #jgd
+            #print "looking up " + str(lookup_list)
             table_count += 1
             try:
                 # "current" is a piece of the lookup list. For example, in
@@ -1240,10 +1319,16 @@
                     # If we're here, lookup_list is empty but param_required
                     # is set to True, which means the kwarg was bad.
                     # Example: choices.get_list(poll__exact='foo')
+                    #jgd
+                    #print "bad lookup pop"
                     _throw_bad_kwarg_error(kwarg)
                 # Try many-to-many relationships first...
                 for f in current_opts.many_to_many:
+                    #jgd
+                    #print "trying many to many " + str(f.name)
                     if f.name == current:
+                        #jgd
+                        #print "found m-to-m rel"
                         rel_table_alias = 't%s' % table_count
                         table_count += 1
                         tables.append('%s %s' % (f.get_m2m_db_table(current_opts), rel_table_alias))
@@ -1252,26 +1337,39 @@
                         # Optimization: In the case of primary-key lookups, we
                         # don't have to do an extra join.
                         if lookup_list and lookup_list[0] == f.rel.to.pk.name and lookup_type == 'exact':
+                            #jgd
+                            #print "doing m-to-m pk lookup"
                             where.append(_get_where_clause(lookup_type, rel_table_alias+'.',
                                 f.rel.to.object_name.lower()+'_id', kwarg_value))
                             params.extend(f.get_db_prep_lookup(lookup_type, kwarg_value))
                             lookup_list.pop()
                             param_required = False
                         else:
+                            #jgd
+                            #print "doing m-to-m regular lookup"
                             new_table_alias = 't%s' % table_count
                             tables.append('%s %s' % (f.rel.to.db_table, new_table_alias))
                             join_where.append('%s.%s_id = %s.%s' % (rel_table_alias, f.rel.to.object_name.lower(),
                                 new_table_alias, f.rel.to.pk.column))
                             current_table_alias = new_table_alias
                             param_required = True
+                        #jgd
+                        #print "switching opts to be relative to m-to-m join target and jumping to next lookup"
                         current_opts = f.rel.to
                         raise StopIteration
                 for f in current_opts.fields:
+                    #jgd
+                    #print "trying one to many " + str(f.name)
+
                     # Try many-to-one relationships...
                     if f.rel and f.name == current:
+                        #jgd
+                        #print "found 1-to-m rel "
                         # Optimization: In the case of primary-key lookups, we
                         # don't have to do an extra join.
                         if lookup_list and lookup_list[0] == f.rel.to.pk.name and lookup_type == 'exact':
+                            #jgd
+                            #print "pk look up"
                             where.append(_get_where_clause(lookup_type, current_table_alias+'.', f.column, kwarg_value))
                             params.extend(f.get_db_prep_lookup(lookup_type, kwarg_value))
                             lookup_list.pop()
@@ -1280,25 +1378,35 @@
                         # because we don't want to do a join. We just want to find out
                         # whether the foreign key field is NULL.
                         elif lookup_type == 'isnull' and not lookup_list:
+                            #jgd
+                            #print "isnull lookup"                        
                             where.append(_get_where_clause(lookup_type, current_table_alias+'.', f.column, kwarg_value))
                             params.extend(f.get_db_prep_lookup(lookup_type, kwarg_value))
                         else:
+                            #jgd
+                            #print "regular 1-to-m lookup"                        
                             new_table_alias = 't%s' % table_count
                             tables.append('%s %s' % (f.rel.to.db_table, new_table_alias))
                             join_where.append('%s.%s = %s.%s' % (current_table_alias, f.column, \
                                 new_table_alias, f.rel.to.pk.column))
                             current_table_alias = new_table_alias
                             param_required = True
+                        #jgd
+                        #print "switching opts to be relative to 1-to-m join target and jumping to next lookup"
                         current_opts = f.rel.to
                         raise StopIteration
                     # Try direct field-name lookups...
                     if f.name == current:
+                        #jgd
+                        #print "found direct field name"
                         where.append(_get_where_clause(lookup_type, current_table_alias+'.', f.column, kwarg_value))
                         params.extend(f.get_db_prep_lookup(lookup_type, kwarg_value))
                         param_required = False
                         raise StopIteration
                 # If we haven't hit StopIteration at this point, "current" must be
                 # an invalid lookup, so raise an exception.
+                #jgd
+                #print "can't figure it out"
                 _throw_bad_kwarg_error(kwarg)
             except StopIteration:
                 continue
@@ -1363,7 +1471,9 @@
     kwargs['where'] = ["%s.%s IN (%s)" % (opts.db_table, opts.pk.column, ",".join(['%s'] * len(id_list)))]
     kwargs['params'] = id_list
     obj_list = function_get_list(opts, klass, **kwargs)
-    return dict([(getattr(o, opts.pk.column), o) for o in obj_list])
+    #jgd
+    #return dict([(getattr(o, opts.pk.column), o) for o in obj_list])
+    return dict([(getattr(o, opts.pk.name), o) for o in obj_list])
 
 def function_get_latest(opts, klass, does_not_exist_exception, **kwargs):
     kwargs['order_by'] = ('-' + opts.get_latest_by,)
@@ -1433,8 +1543,12 @@
                 lookup_kwargs = opts.one_to_one_field.rel.limit_choices_to
                 lookup_kwargs['%s__exact' % opts.one_to_one_field.rel.field_name] = obj_key
                 _ = opts.one_to_one_field.rel.to.get_model_module().get_object(**lookup_kwargs)
-                params = dict([(f.column, f.get_default()) for f in opts.fields])
-                params[opts.pk.column] = obj_key
+
+                #jgd
+                #params = dict([(f.column, f.get_default()) for f in opts.fields])
+                #params[opts.pk.column] = obj_key
+                params = dict([(f.name, f.get_default()) for f in opts.fields])
+                params[opts.pk.name] = obj_key                
                 self.original_object = opts.get_model_module().Klass(**params)
             else:
                 raise
@@ -1469,13 +1583,18 @@
     for f in opts.fields:
         # Fields with auto_now_add are another special case; they should keep
         # their original value in the change stage.
+
+        #jgd
         if change and getattr(f, 'auto_now_add', False):
-            params[f.column] = getattr(self.original_object, f.name)
+            #params[f.column] = getattr(self.original_object, f.name)
+            params[f.name] = getattr(self.original_object, f.name)
         else:
-            params[f.column] = f.get_manipulator_new_data(new_data)
+            #params[f.column] = f.get_manipulator_new_data(new_data)
+            params[f.name] = f.get_manipulator_new_data(new_data)
 
     if change:
-        params[opts.pk.column] = self.obj_key
+        #params[opts.pk.column] = self.obj_key
+        params[opts.pk.name] = self.obj_key
 
     # First, save the basic object itself.
     new_object = klass(**params)
@@ -1490,7 +1609,10 @@
     if change:
         self.fields_added, self.fields_changed, self.fields_deleted = [], [], []
         for f in opts.fields:
-            if not f.primary_key and str(getattr(self.original_object, f.column)) != str(getattr(new_object, f.column)):
+            #jgd
+            #if not f.primary_key and str(getattr(self.original_object, f.column)) != str(getattr(new_object, f.column)):
+            if not f.primary_key and str(getattr(self.original_object, f.name)) != str(getattr(new_object, f.name)):
+                #jgd really want verbose_name here?
                 self.fields_changed.append(f.verbose_name)
 
     # Save many-to-many objects. Example: Poll.set_sites()
@@ -1541,15 +1663,25 @@
                 # case, because they'll be dealt with later.
                 if change and (isinstance(f, FileField) or not f.editable):
                     if rel_new_data.get(rel_opts.pk.name, False) and rel_new_data[rel_opts.pk.name][0]:
-                        params[f.column] = getattr(old_rel_obj, f.column)
+                        #jgd
+                        #params[f.column] = getattr(old_rel_obj, f.column)
+                        params[f.name] = getattr(old_rel_obj, f.name)
                     else:
-                        params[f.column] = f.get_default()
+                        #jgd
+                        #params[f.column] = f.get_default()
+                        params[f.name] = f.get_default()
                 elif f == rel_field:
-                    params[f.column] = getattr(new_object, rel_field.rel.field_name)
+                    #jgd
+                    #params[f.column] = getattr(new_object, rel_field.rel.field_name)
+                    params[f.name] = getattr(new_object, rel_field.rel.field_name)
                 elif add and isinstance(f, AutoField):
-                    params[f.column] = None
+                    #jgd
+                    #params[f.column] = None
+                    params[f.name] = None
                 else:
-                    params[f.column] = f.get_manipulator_new_data(rel_new_data, rel=True)
+                    #jgd
+                    #params[f.column] = f.get_manipulator_new_data(rel_new_data, rel=True)
+                    params[f.name] = f.get_manipulator_new_data(rel_new_data, rel=True)
                 # Related links are a special case, because we have to
                 # manually set the "content_type_id" and "object_id" fields.
                 if opts.has_related_links and rel_opts.module_name == 'relatedlinks':
@@ -1575,7 +1707,9 @@
                         self.fields_added.append('%s "%r"' % (rel_opts.verbose_name, new_rel_obj))
                     else:
                         for f in rel_opts.fields:
-                            if not f.primary_key and f != rel_field and str(getattr(old_rel_obj, f.column)) != str(getattr(new_rel_obj, f.column)):
+                            #jgd
+                            #if not f.primary_key and f != rel_field and str(getattr(old_rel_obj, f.column)) != str(getattr(new_rel_obj, f.column)):
+                            if not f.primary_key and f != rel_field and str(getattr(old_rel_obj, f.name)) != str(getattr(new_rel_obj, f.name)):
                                 self.fields_changed.append('%s for %s "%r"' % (f.verbose_name, rel_opts.verbose_name, new_rel_obj))
 
                 # Save many-to-many objects.
@@ -1606,7 +1740,9 @@
     else:
         kwargs = {'%s__iexact' % field_name_list[0]: field_data}
     for f in field_list[1:]:
-        field_val = all_data.get(f.column, None)
+        #jgd
+        #field_val = all_data.get(f.column, None)
+        field_val = all_data.get(f.name, None)
         if field_val is None:
             # This will be caught by another validator, assuming the field
             # doesn't have blank=True.
@@ -1620,7 +1756,9 @@
         old_obj = mod.get_object(**kwargs)
     except ObjectDoesNotExist:
         return
-    if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.column) == getattr(old_obj, opts.pk.column):
+    #jgd
+    #if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.column) == getattr(old_obj, opts.pk.column):
+    if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.name) == getattr(old_obj, opts.pk.name):
         pass
     else:
         raise validators.ValidationError, "%s with this %s already exists for the given %s." % \
@@ -1646,7 +1784,9 @@
     except ObjectDoesNotExist:
         return
     else:
-        if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.column) == getattr(old_obj, opts.pk.column):
+        #jgd
+        #if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.column) == getattr(old_obj, opts.pk.column):
+        if hasattr(self, 'original_object') and getattr(self.original_object, opts.pk.name) == getattr(old_obj, opts.pk.name):
             pass
         else:
             format_string = (lookup_type == 'date') and '%B %d, %Y' or '%B %Y'
