Giter Site home page Giter Site logo

Comments (9)

GeyseR avatar GeyseR commented on August 22, 2024

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.

jantoniomartin avatar jantoniomartin commented on August 22, 2024

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.

GeyseR avatar GeyseR commented on August 22, 2024

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.

jantoniomartin avatar jantoniomartin commented on August 22, 2024

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:

  1. Create a new setting (PYBB_PROFILE_MANAGE) with a default value of True. If True, pybbm works exactly as before.
  2. Disable some parts of the code (only 5 files are affected, and only with minor changes) only when this setting is False.
  3. 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.

GeyseR avatar GeyseR commented on August 22, 2024

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.

jantoniomartin avatar jantoniomartin commented on August 22, 2024

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.

jantoniomartin avatar jantoniomartin commented on August 22, 2024

@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.

jantoniomartin avatar jantoniomartin commented on August 22, 2024

Are these changes expected to be merged in the "master" branch?

from pybbm.

GeyseR avatar GeyseR commented on August 22, 2024

merged

from pybbm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.