New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

django "__in" is not working with dj.choices objects #1

Closed
mrezk opened this Issue May 21, 2012 · 4 comments

Comments

Projects
None yet
2 participants
@mrezk

mrezk commented May 21, 2012

I have the following classes:

class Status(Choices):
    good = Choice("good")
    bad = Choice("bad")
    ugly = Choice("ugly")

class StatusHolder(models.Model):
    status = ChoiceField(choices=Status, default=Status.good)
    ...

If I do:

StatusHolder.objects.filter(status__in=[Status.good, Status.ugly])

I get:

AttributeError: 'list' object has no attribute 'id'

I think this should work as any other field, am I right?

@ambv

This comment has been minimized.

Show comment
Hide comment
@ambv

ambv May 21, 2012

Owner

You're right. I will investigate this. Django 1.4?

Owner

ambv commented May 21, 2012

You're right. I will investigate this. Django 1.4?

@mrezk

This comment has been minimized.

Show comment
Hide comment
@mrezk

mrezk May 21, 2012

Forgot to say, I'm using Django 1.3!

mrezk commented May 21, 2012

Forgot to say, I'm using Django 1.3!

@ambv ambv closed this in 8e04a82 Jun 7, 2012

@mrezk

This comment has been minimized.

Show comment
Hide comment
@mrezk

mrezk Jun 11, 2012

Thanks man! It worked great!

mrezk commented Jun 11, 2012

Thanks man! It worked great!

@ambv

This comment has been minimized.

Show comment
Hide comment
@ambv

ambv Jun 12, 2012

Owner

Thanks for reporting the bug.

Owner

ambv commented Jun 12, 2012

Thanks for reporting the bug.

ambv added a commit that referenced this issue Jun 18, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment