Comments (9)
Yes, you can proxy fields that you have in different models, and add required fields in forum profile model.
Answer to second question (or suggestion): pybbm forum uses profile fields for specific forum functionality, you can search for using this felds in app, and do not use some of them if this will not break functionality.
from pybbm.
Not easy, but I keep investigating. What I have made so far:
I have added the following fields to my profile class: signature, signature_html, show_signatures, post_count, autosubscribe and I have copied the save() method from PybbProfile.
Then, I have added the properties time_zone, language, avatar and avatar_url (not fields, since these data are already stored by django-user-accounts and django-avatar) that return the values in the same format that PybbProfile would.
With these overrides, with every request I make, I get a FieldError, because pybb.forms.EditProfileForm expects a user class that has time_zone, language and avatar as fields, not as properties. So I'm stuck now, because I can't see a clean way to prevent this behavior.
I will investigate further and, as a last resort, I might need to make a fork where I can decouple the user profile functionality from the forum functionality.
from pybbm.
Managing profiles is not a primary goal of pybbm app. Edit profile view decoupled from forum (uses only in profile page), so you can provide your own view, which uses you own template and form. Just insert such line in urls.py
url('^forum/profile/edit/$', CustomProfileEditView.as_view(), name='pybb:edit_profile'),
before
url(r'^forum/', include('pybb.urls', namespace='pybb')),
I didn't try it myself, but it should work properly.
from pybbm.
Unfortunately, it's not so simple. Apparently, when the application is started, django expects a profile class with specific fields (time_zone, language and avatar), even if you override the url. When it doesn't find these fields, it raises an error.
I have forked your repo and managed to integrate my custom profile, django-user-accounts, django-avatar and pybbm. This is a summary of the steps I have taken:
- Create a new setting (PYBB_PROFILE_MANAGE) with a default value of True. If True, pybbm works exactly as before.
- Disable some parts of the code (only 5 files are affected, and only with minor changes) only when this setting is False.
- In my project, override the templates avatar.html, topic.html and _need_to_login_message.html, just to change some url tags and the avatar rendering code. These are the only ones where I have found problems.
I have integrated this customized pybbm in my site (http://condottierigame.net/forum/) and it works fine. If you are curious about these changes you can see them in jantoniomartin@555134a. I have not made a pull request because I think that maybe these changes go against your conception of pybbm, but I can make it if you like them.
from pybbm.
Please, see referenced commit.
I think it more simple and right solution for your problem.
I can't understand why do you filter out util.get_pybb_profile_model function. It should return right forum profile model and you have to set PYBB_PROFILE_RELATED_NAME for appropriate value. See docs about this
from pybbm.
Your solution looks better integrated in the existing code than mine, and makes an additional setting unnecesary. I will test it as soon as I can. I'd rather use your repository, so that I can keep the application updated.
Nonetheless, I think that I still need to override the three templates that I mentioned and the affected url patterns, but this is no big deal.
Thanks a lot for your help.
from pybbm.
@GeyseR, I have just tested it and it works even better than I expected, because I don't need to override any urlconfs, as long as I override these three templates:
- avatar.html
- topic.html
- _need_to_login_message.html
Many thanks again.
from pybbm.
Are these changes expected to be merged in the "master" branch?
from pybbm.
merged
from pybbm.
Related Issues (20)
- Template Rendering Error when trying to override the default template. HOT 10
- Add tests for management commands
- Add optionnal dependencies in setup.py
- Add test to check python style
- version 1.0 HOT 1
- context must be a dict rather than Context Django 1.1 HOT 7
- Strange language in login request message HOT 1
- Emoji dont work HOT 1
- can't login with example project HOT 4
- can't open thread when not logged in HOT 2
- missing CSS and HTML when app used as part of a larger project HOT 8
- Can't view profiles with weird usernames HOT 2
- Logging error
- `user_saved` signal handler tries to create profile, causing an IntegrityError HOT 3
- Demo on pybbm.org is broken HOT 5
- COPYRIGHT issue HOT 9
- Mistake. Or not.
- Migration
- Code to handle mysql transactions atomically for Topic/Forum ReadTracker broken of postgresql with read replicas
- Django 3.0+ incompatible HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybbm.