[Django]-Django inheritance base class super

5👍

There is a workaround:

Resource Meta Inheritance

Also look at: Tastypie Meta Inheritance

👤Sid

0👍

Inherit Meta explicitly and separately from the Resource, as it’s a separately-defined class:

class CommonMeta:
    abstract = True
    authentication = SessionAuthentication()
    authorization= Authorization()      
    allowed_methods = ('get', 'post', 'put', 'delete', 'patch')

class MyResource(ModelResource):
    ...

    class Meta(CommonMeta):
        # Inherits CommonMeta's properties. 
        # Note: abstract will become False automatically.

        queryset = MyModel.objects.all()
        resource_name = 'my_model'

Leave a comment