question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Similar field names with PageUser and my custom user model

See original GitHub issue

I have a similar problem as @jrief describes in #3973. We use django 1.8.2 with a custom user Model and as i tried to install django-cms 3.1.1 i got the following error:

django.core.exceptions.FieldError: Local field 'created_by' in class 'PageUser' clashes with field of similar name from base class 'Contact'

Unfortunately my custom User model already has a created_by Field. And django does not allow to override any Field attribute from the parent Model.

Since the PageUser model does not add any logic rather than the created_by Field, the best solution for me would be to swap the PageUser model like django does with auth.User. Are there any Plans to support that functionality? If not, i could invest some time and send a PR.

Or anyone else ran into the same problem and can give a hint?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jvamvascommented, May 17, 2016

This issue still exists with 3.2.5 as the PageUser model has not changed.

@yakky correctly states that a OneToOneField would be a better way to store CMS user data than inheriting from AUTH_USER_MODEL.

Another, more short-term, strategy would be to rename the field to something that is less probable to clash with a custom user model, such as page_user_created_by:

class PageUser(User):
    page_user_created_by = models.ForeignKey(settings.AUTH_USER_MODEL, 
                                             related_name="created_users", db_column='created_by')
1reaction
yakkycommented, Jul 11, 2015

@walterrenner PageUser is a way to add information to the User, and it’s not mean to be a User model substitute Long-term, they way to fix this is to use an explicit OneToOneField, rather than extending from the User model

Read more comments on GitHub >

github_iconTop Results From Across the Web

Similar field names with PageUser and my custom user model
I have a similar problem as @jrief describes in #3973. We use django 1.8.2 with a custom user Model and as i tried...
Read more >
Django user model custom fields names - Stack Overflow
How to rename fields of the user model?
Read more >
Creating a Custom User Model in Django - TestDriven.io
This post explains step-by-step how to create a custom User model in Django.
Read more >
Model Reference - Wagtail's documentation
In addition to the model fields provided, Page has many properties and methods that you may wish to ... Custom name for page...
Read more >
User pages overview - Webflow University
Click the “plus” icon to the right of Custom fields; Select the field from the Add input dropdown. If you added a minimum...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found