Jason
Jason

Reputation: 11363

Implement Django aggregate object that is not mapped to database

I have a model query function written in a test as

contracts = Contracts.objects.all()
contractPlans = ContractPlans.objects.filter(contractnum__in = contracts)
parentorgs = Parentorgs.objects.all()


for plan in contractPlans:

    contractPlanTags = ContractPlanTags.objects.filter(contractnum = plan.contractnum)
    for planTags in  contractPlanTags:
        #do more stuff here

Is it possible to have a non database mapped object where I can put in specific fields from parentorgs, contracts, contractPlans and contractPlanTags to be sent to the view? Essentially, I just want a plain old data object to be used as a container wrapper for specific fields over four sets.

Upvotes: 0

Views: 411

Answers (1)

Aamir Rind
Aamir Rind

Reputation: 39689

Maybe you need Django Abstract Base Class

Remember Abstract Base Class is not database object and hence can not be queried also.

Upvotes: 1

Related Questions