Indexing and ordering troubles
It's just a little thing:

``` python
(('mac_address'), False),
```

should be:

``` python
(('mac_address',), False), # <-- missing comma inside parentheses makes act like a string, not tuple
```
 Thanks.

Maybe you should raise a custom exception when that happens, to avoid confusion?

On 16/10/2012, at 16:06, Charles Leifer notifications@github.com wrote:

> It's just a little thing:
> 
> (('mac_address'), False),
> should be:
> 
> (('mac_address',), False), # <-- missing comma inside parentheses makes act like a string, not tuple
> —
> Reply to this email directly or view it on GitHub.

While trying to create an index on a table, I've come across an error that I can't fathom, but which appears to be due to some mismatch between what I can see on ReadTheDocs and currently working code.

Here's my sample model:

``` python
#!/usr/bin/env python

"""
Test Case
"""

import os, sys, logging, datetime, platform

logging.basicConfig(format='localhost - - [%(asctime)s] %(message)s', level=logging.DEBUG)
log = logging.getLogger(__name__)

from peewee import *

log = logging.getLogger()

db = SqliteDatabase('app.db')
db.connect()

class CustomModel(Model):
    class Meta:
        database = db

class Queue(CustomModel):
    """Represents queued instructions for a client device"""
    scheduled   = DateTimeField(primary_key=True,unique=True,default=datetime.datetime.now)
    mac_address = CharField(null=False)
    action      = CharField(null=False)
    data        = CharField(null=True)
    sent        = BooleanField(default=False)

    class Meta:
        indexes = (
            (('mac_address'), False),
        )
        order_by = ('-scheduled',)


Queue.create_table()
```

When I run the script above, I get:

```
localhost - - [2012-10-16 14:16:10,647] ('CREATE TABLE "queue" ("scheduled" DATETIME NOT NULL PRIMARY KEY, "mac_address" VARCHAR(255) NOT NULL, "action" VARCHAR(255) NOT NULL, "data" VARCHAR(255), "sent" SMALLINT NOT NULL)', None)
localhost - - [2012-10-16 14:16:10,680] ('CREATE UNIQUE INDEX "queue_scheduled" ON "queue" ("scheduled")', None)
Traceback (most recent call last):
  File "test.py", line 39, in <module>
    Queue.create_table()
  File "/home/rcarmo/codebits/peewee.py", line 1969, in create_table
    db.create_index(cls, fields, unique)
  File "/home/rcarmo/codebits/peewee.py", line 1548, in create_index
    field_objs = [model_class._meta.fields[f] if isinstance(f, basestring) else f for f in fields]
KeyError: 'm'
```

Any idea on what I'm doing wrong?
