djangonauts / django-hstore

PostgreSQL HStore support for Django.
http://django-hstore.readthedocs.io/
Other
517 stars 142 forks source link

Feature request: support keyword args in create for schema hstore #56

Closed mikob closed 10 years ago

mikob commented 10 years ago

It would be really nice to be able to do:

Order.objects.create(send_emails=True, send_texts=False)

Where send_emails and send_texts are defined in my schema like so:

props = hstore.DictionaryField(schema=[
    {
        'name': 'send_texts',
        'class': 'BooleanField',
        'kwargs': {
            'default': True
        }
    },
    {
        'name': 'send_emails',
        'class': 'BooleanField',
        'kwargs': {
            'default': True
        }
    },
])
nemesifier commented 10 years ago

Yes true. It would also be nice to do stuff like filter(send_emails=True) or filter(send_text=True). I don't know how much effort it requires, I'm sure it needs a great deal of studying the django internals, but it would be worth it.

nemesifier commented 10 years ago

with the latest changes this works. I simplified the schema mode a greate deal, now you don't have to extend hstore.SchemaModel anymore.

mikob commented 10 years ago

Awesome! WFM.