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

Problem creating non-roa proxy models #27

Open
cript0nauta opened this issue Mar 11, 2015 · 0 comments
Open

Problem creating non-roa proxy models #27

cript0nauta opened this issue Mar 11, 2015 · 0 comments

Comments

@cript0nauta
Copy link

Hi, i'm trying to create a proxy for some ROA model that will use a normal manager insted of a ROAManager to make queries in a SQL database (i have read access only, that's why i use ROA). The problem is that i can't set the default manager correctly. This is part of my code:

class SomeROAModelProxy(SomeROAModel):
    class Meta(SomaROAModel.Meta):
        proxy = True
    objects = models.Manager()

and here is my problem:

>>> SomeROAModel._default_manager 
<django_roa.db.managers.ROAManager at 0x2470250>
>>> SomeROAModelProxy._default_manager
<django_roa.db.managers.ROAManager at 0x303d2d0>
>>> SomeROAModel._default_manager is SomeROAModelProxy._default_manager
False

The manager of SomeROAModelProxy shoud be a models.Manager instance. If I do the same with the User model for example, it works well:

class UserProxy(User):
    class Meta(User.Meta):
        proxy = True
    objects = models.Manager()

>>> User._default_manager
<django.contrib.auth.models.UserManager at 0x33ded50>
>>> UserProxy._default_manager
<django.db.models.manager.Manager at 0x3fbaa10>
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

1 participant