Here's a simplification of what I'm trying to accomplish:
class B inherits from A.
Class B is supposed to override the call_me method in class A.
I'm using google app engine (maybe that's why?)
from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel
class A(polymodel.PolyModel):
def call_me(self):
print "super class called"
return
@classmethod
def get_call_me(cls, qry)
return [m.call_me() for m in qry]
class B(A):
def call_me(self):
print "sub class method called"
return
When I call
object_b = B()
all_A = A.query() # get's object_b as well because object_b is an A
A.get_call_me(all_A)
I get "super class called" in the terminal.
How do I make sure "sub class method called" is fired instead/also?
class B is an A by inheritance (in the datastore it shows up as ['A', 'B']). But, I don't want call_me from class A to be called.
when I call B().__class__.__name__
, I get 'A'
What's the right way to go about this?
Never mind. It looks like this code works. I was using a projection qry so it didn't have access to the method? I don't quite understand how that works.