Index: django/core/db/backends/mysql.py
===================================================================
--- django/core/db/backends/mysql.py	(revision 2357)
+++ django/core/db/backends/mysql.py	(working copy)
@@ -137,15 +137,23 @@
 
 def get_indexes(cursor, table_name):
     """
-    Returns a dictionary of fieldname -> infodict for the given table,
+    Returns a dictionary of key_name -> infodict for the given table,
     where each infodict is in the format:
-        {'primary_key': boolean representing whether it's the primary key,
-         'unique': boolean representing whether it's a unique index}
+        {'unique': boolean representing whether it's a unique index,
+         'columns': list of columns in the index}
     """
     cursor.execute("SHOW INDEX FROM %s" % DatabaseWrapper().quote_name(table_name))
     indexes = {}
     for row in cursor.fetchall():
-        indexes[row[4]] = {'primary_key': (row[2] == 'PRIMARY'), 'unique': not bool(row[1])}
+        key_name = row[2]
+        column_name = row[4]
+        unique = not bool(row[1])
+        if not indexes.has_key(key_name):
+            indexes[key_name] = {
+                'unique': unique,
+                'columns': []
+            }
+        indexes[key_name]['columns'].append(column_name)
     return indexes
 
 OPERATOR_MAPPING = {
Index: django/core/management.py
===================================================================
--- django/core/management.py	(revision 2357)
+++ django/core/management.py	(working copy)
@@ -639,11 +639,19 @@
 
                 # Add primary_key and unique, if necessary.
                 column_name = extra_params.get('db_column', att_name)
-                if column_name in indexes:
-                    if indexes[column_name]['primary_key']:
-                        extra_params['primary_key'] = True
-                    elif indexes[column_name]['unique']:
-                        extra_params['unique'] = True
+                # Check if this field is the sole primary key.
+                if indexes.has_key('PRIMARY') and \
+                   column_name in indexes['PRIMARY']['columns'] and \
+                   len(indexes['PRIMARY']['columns']) == 1:
+                    extra_params['primary_key'] = True
+                else:
+                    # Check if this field is part of any other unique index.
+                    # Don't assume this field to be unique when the index
+                    # spans several columns.
+                    for index_name in indexes:
+                        if column_name in indexes[index_name]['columns'] and \
+                           len(indexes[index_name]['columns']) == 1:
+                            extra_params['unique'] = True
 
                 field_type += '('
 
@@ -663,6 +671,10 @@
             yield '    %s' % field_desc
         yield '    class META:'
         yield '        db_table = %r' % table_name
+        for index_name in indexes:
+            if indexes[index_name]['unique'] and len(indexes[index_name]['columns']) > 1:
+                yield '        unique_together = ((%s),)' % ', '.join(['"%s"' % column_name for column_name in indexes[index_name]['columns']])
+                break
         yield ''
 inspectdb.help_doc = "Introspects the database tables in the given database and outputs a Django model module."
 inspectdb.args = "[dbname]"
