Similar field names with PageUser and my custom user model
See original GitHub issueI 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:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 fromAUTH_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
:@walterrenner
PageUser
is a way to add information to the User, and it’s not mean to be aUser
model substitute Long-term, they way to fix this is to use an explicit OneToOneField, rather than extending from theUser
model