Skip to content
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

TradeItem drill_down() method is outrageous #92

Open
jMyles opened this issue Jun 26, 2012 · 0 comments
Open

TradeItem drill_down() method is outrageous #92

jMyles opened this issue Jun 26, 2012 · 0 comments

Comments

@jMyles
Copy link
Member

jMyles commented Jun 26, 2012

I'll just let it speak for itself:

    def drill_down(self):
        """
        Stupid and hopefully temporary.  Some of the worst code of my life in this function here.

        TODO: Unstupify.

        See http://stackoverflow.com/questions/5348157/find-object-in-child-class-from-object-in-parent-class-in-django
        """
        try:             
            return self.moneybagpiece
        except:
            try:
                return self.realthing.ingredientstock
            except:
                try:
                    return self.realthing.device
                except:
                    return self.realthing

Obviously we can do better with django-model-utils.

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

No branches or pull requests

1 participant