mypebble/django-pgviews

Projection not working with MaterializedView

Opened this issue · 2 comments

When I use a string Projection and try to filter on a field my view should have, I get this error FieldError: cannot resolve keyword 'x' into field. Choices are: id.

After a quick investigation in the ViewMeta, it seems the fields from my real model are not being copied immediately and are put in a deferred situation because they are strings. The thing is, as they are deferred, the super new is called without them being attributed and that apparently causes django to miss them. I then only get one field on my view in the end, which is id.

As the issue was with the projection being a string, I tried putting projection = MyModel._meta.fields but got an error with reverse name clashes on the foreign keys.

Do you have any solution for this problem ?
I don't want to specify every field on my view especially since they are the same.

Hi @PhilipGarnero ,

I have the same problem and I could not find a solution, did you find any solutions?

Hey there, apologies for not replying.

I no longer work for Pebble and, as far as I know, Pebble are no longer maintaining this project. I'd recommend having a look at forks from this project that may be able to better support you.