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

PUPUT_USERNAME_FIELD #66

Closed
robslotboom opened this issue Sep 17, 2016 · 9 comments
Closed

PUPUT_USERNAME_FIELD #66

robslotboom opened this issue Sep 17, 2016 · 9 comments
Labels

Comments

@robslotboom
Copy link

get_entries() in puput.models BlogPage raises an error.

def get_entries(self):
    field_name = 'owner__%s' % getattr(settings, 'PUPUT_USERNAME_FIELD', 'username')
    return EntryPage.objects.descendant_of(self).live().order_by('-date')#.select_related(field_name)

This results in select_related('owner__username') which is wrong and shoud be
select_related('owner')

@marctc
Copy link
Collaborator

marctc commented Sep 27, 2016

Did you extend the default Django User model? Did you remove the username field in that custom User model?
If the above questions have an affirmative answer you should set PUPUT_USERNAME_FIELD with a proper username field.

@marctc marctc changed the title PUPUT_USERNAE_FIELD PUPUT_USERNAME_FIELD Sep 27, 2016
@robslotboom
Copy link
Author

Did you extend the default Django User model?
Yes

Did you remove the username field in that custom User model?
No

If the above questions have an affirmative answer you should set PUPUT_USERNAME_FIELD with a proper username field.

Are you absolutely sure?
In my opinion select_related('owner__username') is pointing to a non FK-field.

Ir raises:

django.core.exceptions.FieldError: Non-relational field given in select_related: 'username'. Choices are: user_profiles, userprofile

@marctc
Copy link
Collaborator

marctc commented Sep 27, 2016

What Django version are you using?

@robslotboom
Copy link
Author

1.10.1

@marctc
Copy link
Collaborator

marctc commented Sep 28, 2016

Hi @robslotboom. I did some tests and I could reproduce the error. I'll fix it ASAP.

Thanks!

@marctc marctc added the bug label Sep 28, 2016
@robslotboom
Copy link
Author

Hi Marc,

You are welcome.
And thank you for the nice app you made.

Best regards,

Robert Slotboom

Op 28 sep. 2016, om 12:20 heeft Marc Tudurí notifications@github.com het volgende geschreven:

Hi @robslotboom. I do some tests and I could reproduce the error. I'll fix it ASAP.

Thanks!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@lgellert
Copy link

I just ran into the same exact error as @robslotboom.

@marctc
Copy link
Collaborator

marctc commented Oct 17, 2016

It seems that Puput is not fully compatible with Django 1.10 right now. I'll fix it ASAP.

thanks

@marctc
Copy link
Collaborator

marctc commented Oct 23, 2016

Fixed in the last commit

@marctc marctc closed this as completed Oct 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants