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

How to handle proxy models? #19

Closed
ciarancourtney opened this issue Sep 26, 2017 · 2 comments
Closed

How to handle proxy models? #19

ciarancourtney opened this issue Sep 26, 2017 · 2 comments

Comments

@ciarancourtney
Copy link

Say I have proxy models BarA and BarB like:

class Foo(models.Model):
    bar = models.ForeignKey(Bar)

    ql_fields = ('bar',)

class Bar(models.Model):
    name = models.CharField()
    a_stuff = models.CharField()
    b_stuff = models.CharField()

class BarA(Bar):

    ql_fields = ('a_stuff',)

    class Meta:
        proxy = True

class BarB(Bar):

    ql_fields = ('b_stuff',)

    class Meta:
        proxy = True

When specifying the lookup fields for Foo.bar (all of which are on the base model), how can I handle distinct field lookups on each proxy?

Would it be possible to specify in Foo as ql_fields = ('bara', 'barb') and for DjangoQL to find the proxies? Or would it make more sense to create a set of all the ql_fields of all proxy models?

@stebunovd
Copy link
Member

sorry, I'm not sure what you mean. ql_fields is not a part of DjangoQL API, you should specify lookup fields using Schema classes and not Django model classes, please refer to examples in the docs

@stebunovd
Copy link
Member

closing due to inactivity

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

No branches or pull requests

2 participants