Permalink
Commits on Apr 26, 2013
  1. Make this error message cover both cases, otherwise it's a bit confus…

    …ing.
    
    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Apr 26, 2013
  2. On an invalid /value/ don't raise an error about invalid /slugs/

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Apr 26, 2013
Commits on Feb 5, 2013
  1. Do not break if 'default' kwarg is a callable.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Feb 5, 2013
Commits on Jan 17, 2013
  1. Make make_enum simply create an Enumeration, not an EnumerationMeta

    This avoids a bunch of duplicated code as well as fixes __iter__ for
    make_enum iterables.
    
    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2013
  2. Make the iterable interface of an Enumeration actually useful.

    It always annoyed me how iter(Enumeration) didn't return
    iter(Enumeration.get_items()), meaning that you had to do:
    
       for enum in MyEnum.get_items():
           # [..]
    
    to loop over an Enumeration's items.
    
    It used to return the upper case "slugs" which are pretty much completely
    useless - the only way you can use the upper case versions is to then call
    getitem (or getattr!) *back* on the Enumeration you just got them from; you
    can't use them as slugs or arguments to a model's EnumField as they are
    the wrong case.
    
    With this commit you can finally do:
    
        for enum in MyEnum:
            # [..]
    
    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2013
Commits on Aug 24, 2012
  1. Default can be None.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Aug 24, 2012
Commits on Jan 19, 2012
Commits on Sep 11, 2011
Commits on Sep 9, 2011
  1. Generate correct "default" values.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Sep 9, 2011
Commits on Aug 30, 2011
  1. Sorted items have to be, well, sorted.

    Thomas Hunger committed Aug 30, 2011
Commits on Aug 25, 2011
  1. Fix: mirror Enumeration API.

    Thomas Hunger committed Aug 25, 2011
  2. Check uniqueness constraints on values and slugs.

    Thomas Hunger committed Aug 25, 2011
  3. Add make_enum function.

    The returned Enumeration types are API compatible with Enumeration.
    The enumerations returned return from EnumerationBase, not Enumeration,
    so you need to change any isinstance tests you may be using.
    Thomas Hunger committed Aug 25, 2011
Commits on Aug 4, 2011
Commits on Jul 15, 2011
Commits on Jul 14, 2011
Commits on Jun 27, 2011
  1. Inherit items from parent classes.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jun 27, 2011
Commits on Jun 16, 2011
  1. Make Enumeration.from_{value,slug} raise an exception when value is b…

    …ogus
    
    Previously we had to check for 'None' which is a bit too C-like - the most
    common case was that we expected the value to exist anyway and we can
    always catch the ensuing exception in the case that we want to do something
    else.
    
    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jun 16, 2011
Commits on Apr 8, 2011
  1. Support __gte (etc.) queries on enum fields.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Apr 8, 2011
Commits on Mar 22, 2011
  1. Add setup.py file

    lamby committed Mar 22, 2011
Commits on Mar 16, 2011
  1. Add South field tuple.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Mar 16, 2011
Commits on Mar 3, 2011
  1. Fix nullable EnumFields.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Mar 3, 2011
Commits on Mar 2, 2011
  1. Allow string arguments (as slugs) when saving/updating EnumFields

    This fixes issues where:
    
      MyModel.objects.update(my_enum_field='slug')
    
    would result in SQL like:
    
      UPDATE app_mymodel SET my_enum_field = 'slug'
    
    .. instead of what that's slug's integer value is.
    
    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Mar 2, 2011
Commits on Feb 7, 2011
  1. Remove README.rst

    lamby committed Feb 7, 2011
Commits on Feb 3, 2011
  1. Update copyright years

    lamby committed Feb 3, 2011
Commits on Jan 17, 2011
  1. Correct syntax error.

    lamby committed Jan 17, 2011
  2. Misc tidying of enumfield.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011
  3. Split into three modules

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011
  4. Add template README.rst

    lamby committed Jan 17, 2011
  5. Split our enum.py out into django_enumfield.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011
  6. Add django_enumfield package.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011
  7. Add COPYING.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011
  8. Add .gitignore.

    Signed-off-by: Chris Lamb <chris@playfire.com>
    lamby committed Jan 17, 2011