You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm still a bit new to Python and after creating a class with its own __init__ method, the Query method doesn't work properly. If a comment my __init__ method, then the object get retrieve properly. I suppose my __init__method override something in the Object class, But it is fairly basic as you can see:
mylists = List.Query.all()
for mylist in mylists:
print mylist.name
print mylist.tasks
I could rewrite everything to not use my own __init__ method, but I would like not to do that as it keeps my code easier to understand. Any ideas on how to fix that? Thanks.
The text was updated successfully, but these errors were encountered:
Please see my StackOverflow answer here for a simple workaround. In short you need to alter your __init__ so that it takes **kwargs, then add Object.__init__(self, **kwargs) to the end of your __init__.
Hi,
I'm still a bit new to Python and after creating a class with its own
__init__
method, the Query method doesn't work properly. If a comment my__init__
method, then the object get retrieve properly. I suppose my__init__
method override something in the Object class, But it is fairly basic as you can see:And the retrieving code is also pretty simple:
I could rewrite everything to not use my own
__init__
method, but I would like not to do that as it keeps my code easier to understand. Any ideas on how to fix that? Thanks.The text was updated successfully, but these errors were encountered: