Giter Site home page Giter Site logo

pybbm's Introduction

PyBBM - Django forum solution

travis coveralls

PyBBM is a full-featured django forum solution with these features:

  • Avatars
  • Custom profiles and support of Custom User Model (since django 1.5)
  • Post editing
  • Pre-moderation
  • Custom sanitization
  • Anonymous posting
  • Subscriptions
  • Polls
  • ...

All features is based on:

  • +94% tests covered code
  • Twitter bootstrap compatible default theme
  • Ready to use example project

The main point in development of pybb is to build it so it could be easily integrated to existing django based site. This mean that pybb does not provide features like user registration, password restoring. It does not provide authentication page. (But example project provides ;))

PyBBM includes ready to use example/test project with instructions

i18n support

PYBB support English, Russian, Slovak, Ukrainian, Brazilian Portuguese, Polish, Hebrew, French, Chinese, Japanese, German, Spanish, Italian, Swedish translations now. Feel free to contribute translation for another language or to correct existing. You should enable django.middleware.locale.LocaleMiddleware to activate django locale autodetecting.

More links

pybbm's People

Contributors

abhaga avatar amigo avatar angerme avatar audreyfeldroy avatar chrisv2 avatar djw avatar dmitri-sintsov avatar dylanncordel avatar geyser avatar goeranu avatar gregmuellegger avatar ivanscm avatar jantoniomartin avatar josseph avatar lampslave avatar leoleozhu avatar lorien avatar lpetre avatar magatz avatar mjumbewu avatar nigma avatar ryochan7 avatar siovene avatar skolsuper avatar somemilk avatar surbas avatar timgates42 avatar william-gr avatar zeus avatar zoldar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybbm's Issues

Create topic from post

Requested feature, that allows creating new topic from existing post and makes this post head of this new topic

Search function...

Is it right that there is no search function ?

Any plans on this? IMHO it's a basic must have feature of any forum software...

Configurable username instead of user.username

Hi,

First of all: thanks for this nice app. It works really well.

One thing is a bit unhandy for my use case though. That is the hardcoded use of user.username. For this project i'm not using the default user.username field (it gets auto-filled with a hash of the user.email field) and so the forum gets filled with all these hashed username fields which do not say anything.

I think that it would be handy to define a setting or model method with which username the forum should use. In my case I can set it to the user.email field or return the user.first_name (and user.last_name) fields.

What do you think?

Vote

Add posts with vote

Circular import issues when setting a custom permissions handler

tl;dr

  • To set PYBB_PERMISSION_HANDLER, I have to import a CustomPermissionHandler.
  • To define CustomPermissionHandler with proper inheritance, I have to import DefaultPermissionHandler
  • When I import DefaultPermissionHandler, PyBBM checks for PYBB_PERMISSION_HANDLER in the settings---while I'm still importing what I need to even define it!

Long Version

I'm trying to set a custom permission handler, so I override the settings variable:

import myapp.forum.permissions
# ...
PYBB_PERMISSION_HANDLER = myapp.forum.permissions.CustomPermissionHandler

All well and good so far, but in order to point to this class I have to actually import its module.

Inside of the imported module, I'm supposed to override DefaultPermissionHandler, so I do so:

import pybb.permissions

class CustomPermissionHandler(DefaultPermissionHandler):
    """There's some code here."""

But now I've imported pybb.permissions! That means the code in pybb.permissions will run before my settings module has finished being defined. And what's in pybb.permissions?

perms = _resolve_class(defaults.PYBB_PERMISSION_HANDLER)

...when this line of code is executed, pybbm looks for the variable in my settings module. But the interpreter hasn't finished defining my settings yet, so it goes ahead and uses the default permission handler anyway, rendering all my hard work for naught.

Proposed Solution

Instead of making me import, define, and dig up the class while settings are being defined, let me use a string which resolves to the class's path. Django does this when defining INSTALLED_APPS, so there's precedent.

Not reading settings

Hello,

I installed PyBBM in my django website but I'm not able to use any of the settings. For example, PYBB_TEMPLATE and PYBB_DEFAULT_AVATAR_URL don't seem to have any effect. I put them at the end of my settings.py in the main project's folder. Is there anything I have to do for them to take effect?

Sorry for opening a new issue, but I can't see any other way to get support.
Thanks.

Registered User Posts

Hi,

Firstly, thanks for this app - It's very uncomplicated and easy to understand.

I'm using it for the first time, and have a simple question that I'm hoping someone can help answer.

I would like to force users to create a profile before they can post.

I've had a look at the docs (https://pybbm.readthedocs.org/en/latest/anonymous.html), where it tells me that I need to set the PYBB_ENABLE_ANONYMOUS_POST to False to disable anonymous posting.

However, I also believe I need to make another entry to my urls.py to enable the following URL to be called when an anonymous user tries to post, for example:

http://www.pybbm.org/accounts/login/?next=/forum/4/topic/add/

The reason is because pybb redirects to the /accounts/login/ url when a non-registered user tries to post.

Can you please confirm that this is in fact what I need to do, and advise what this entry should be in urls.py? I've tried the following, to no avail:

(r'^accounts/login/', include('pybb.urls', namespace='pybb')),

thanks,
Mark

"New Topic" does not add a new topic

I have an almost working pybbm install. I can create categories and forums. But creating a topic (for example using '/forum/3/topic/add/') results in a POST, a delay of several seconds, and a return to the same form with no topic created. There's no indication of a form validation error either. Tracing the generic view AddPostView(PostEditMixin, generic.CreateView) did not reveal anything interesting.

Creating topics from the admin works fine.

pybbm==0.14.3

the label of the signature widget is 'None'

Signature field shows 'None' as the label in the ProfileEditView.

I've fixed it by the next patch.

--- a/pybb/forms.py
+++ b/pybb/forms.py
@@ -185,7 +185,10 @@ try:
fields = ['signature', 'time_zone', 'language',
'show_signatures', 'avatar']

  •    signature = forms.CharField(widget=forms.Textarea(attrs={'rows': 2, 'cols:': 60}), required=False)
    
  •    def **init**(self, _args, *_kwargs):
    
  •        super(EditProfileForm, self).**init**(_args, *_kwargs)
    
  •        self.fields['signature'].widget.attrs['rows']=2
    
  •        self.fields['signature'].widget.attrs['cols']=60
    
     def clean_avatar(self):
         if self.cleaned_data['avatar'] and (self.cleaned_data['avatar'].size > defaults.PYBB_MAX_AVATAR_SIZE):
    

Rebase our work in pybbm

Hi guys,

We have heavily forked pybbm here for the new of Madmoizelle Forums which is a big community: 60k topics, 4M posts.

I'm the lead developer behind this project and I want to know how this work can be integrated into pybbm.

We have added:

  • Moderators which initial permissions
  • Enhanced attachments
  • New views in full CLB
  • A lot of unittests
  • A simple dependency injection layer to override models, views, etc.
  • etc.

Don't hesitate if you want further information about our project.

database creation failed

Anurags-MacBook-Pro:pybbm_org-master anurag_prasad$ sudo -u postgres createdb -O pybbm django;
could not identify current directory: Permission denied
Password:
createdb: database creation failed: ERROR: role "pybbm" does not exist

ImportError pybbm: No module named pybbm

Hi, thank you for making pybbm. I'm excited to get it to work, but am running into trouble. I have setup a fresh django site (which works) and want to add pybbm as an app (but doesn't work). What am I doing wrong? How to fix this? Thanks!!

The error occurs when I try to run:

(mypybbm):python manage.py syncdb --all

My requirements.txt file contains

Django==1.5.1
Markdown==2.3.1
Pillow==1.7.8
South==0.8.1
argparse==1.2.1
django-annoying==0.7.7
django-pure-pagination==0.2.1
postmarkup==1.2.0
psycopg2==2.5
pybbm==0.14
sorl-thumbnail==11.12
wsgiref==0.1.2
yolk==0.4.3

The error traceback is

(mypybbm):python manage.py syncdb --all
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/core/management/init.py", line 453, in execute_from_command_line
utility.execute()
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/core/management/init.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/core/management/init.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/south/management/commands/init.py", line 10, in
import django.template.loaders.app_directories
File "/home/pymarco/.virtualenvs/mypybbm/local/lib/python2.7/site-packages/django/template/loaders/app_directories.py", line 25, in
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError pybbm: No module named pybbm

This is the setup script I am following based on the installation page

pip install sorl-thumbnail

add sorl.thumbnail to settings.py

python manage.py syncdb

pip install pillow==1.7.8
pip install django-pure-pagination
pip install pybbm

add template_context_processors to settings.py

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"pybb.context_processors.processor",
)

add to MIDDLEWARE in settings.py

'pybb.middleware.PybbMiddleware',

python manage.py syncdb --all
python manage.py migrate pybb --fake

Document the block names used in templates

Currently only the parent template is documented and is also configurable. The block names used in the templates are not documented. So for example, if someone does not have a extra_script block in their base.html, they will not get the proper text editor on Topic page and emoticons will not work as well. Same for breadcrumbs.

Here are the 5 block names that are used in the templates:

breadcrumb
content
extra_head
extra_script
title

Adding more css classes for styling and a question

I added the following classes, really new to this whole git/committing thing but I think someone else may benefit from this:

Template: topic.html
Modified line 18-19 to include a class 'post-topic' (should this just be topic?):

{% block content %}
    <h1 class="post-topic">{{ topic.name }}</h1>

Also, when I tried to add a poll to my first post it spits back:

Polls question is required when adding a poll

So I'm not sure what I need to do here, since it defaults to having polls enabled or some such?!

Thanks for pybbm, love it!

Default.py PYBB_DEFAULT_AVATAR_URL

Hi !

I think we can't define our own PYBB_DEFAULT_AVATAR_URL
Because in defaults.py we have this line :
line 21 :
PYBB_DEFAULT_AVATAR_URL = getattr(settings, 'STATIC_URL', '') + 'pybb/img/default_avatar.jpg'

Possible solution :

PYBB_DEFAULT_AVATAR_URL = getattr(settings,'PYBB_DEFAULT_AVATAR_URL',getattr(settings, 'STATIC_URL', '') + 'pybb/img/default_avatar.jpg')

WSGI Problems in middleware

After some troubled hours of investigating all my setup after adding pybb, I finally came down to the error being produced by the line:
from pybb.signals import user_saved
in the middleware.py of pybbm.

which only occured on my apache2+wsgi server and created an unlogged 500 exception. I am currently however investigating if something in the setup is faulty, otherwise I will try to produce a stacktrace and tell if it is really a bug.

For anyone affected however by this behaviour, trycatch the middleware imports. It happens at the time the wsgi application is starting up, so its leaving a bit the horizon of my knowledge. (unfortunately, the wsgi app silently failed even on info)

Incorrect PybbProfile language defaults

When you create a profile, the default value of the field language: language name

language = models.CharField(_('Language'), max_length=10, blank=True,
        choices=settings.LANGUAGES,
        default=dict(settings.LANGUAGES)[settings.LANGUAGE_CODE.split('-')[0]])

This return:

>>>dict(settings.LANGUAGES)[settings.LANGUAGE_CODE.split('-')[0]]
'English'

It may be better to use as the default: LANGUAGE_CODE?

[Discussion] Use a custom signal instead of post_save for notifications

post_save signal may not be the best choice for notification, as it fires every time when the object is saved, for example when you apply data migration or import data via loaddata management command.

I think it would be better if we had our own "post_created" and "post_updated" signals, which would be fired at the end of form_valid in AddPostView/EditPostView. What do you think?

I would be willing to implement that (it's not really difficult after all), just wanted to ask for opinions first.

ForumView doesn't filter topics according to permissions

I overrode filter_topics in my custom pybb PermissionHandler, but found that I was still able to see the existence of forbidden topics by looking at the topic's forum's view. It looks like we want to add a call to perms.filter_topics at the end of get_queryset in ForumView.

pybbm.org down

Hi there,

I’m currently evaluating which forum to use for a planned site... Thereby I noticed your demo site is down: http://pybbm.org gives this:

502 – Bad Gateway

The page you requested is currently unavailable. Please try again later.

If you are the website owner, please see Error: 502 Bad Gateway documentation for more information and possible steps to resolve the problem.

This is bad for a project’s image, makes it look dead...

Valete,
Marvin

[discussion] Using pybbm with an existing custom user profile

I'm trying to integrate pybbm in my django site, and I find some problems with PybbProfile.
I'm using django 1.4, django-user-accounts and django-avatar. My project defines a custom user profile, django-user-accounts defines an Account class where a user can store his timezone and language, and avatar already stores the user's avatar.

How should I use PybbProfile to prevent conflicts with my current classes? I think that simply inheriting my profile class from PybbProfile is not going to work, and apart from signatures and autosubscribe option, I don't need the data that this class defines, but I guess that pybbm does.

Would I have problems if I add to my custom profile the properties from PybbProfile that I need and proxy properties to the ones in django-user-accounts and django-avatar?

By the way, just as an idea (not even a suggestion), wouldn't it be approppriate decoupling the user profile logic from the forum application, so that a project can define its totally customized user profile?

registration_register and auth_login

Hi,

This is the first time I'm using pybbm, and I've found it to be lightweight and easy to plug into an existing django site, which is exactly what I'm looking for.

I have one question though. In "pybb/topic.html" I'm getting the following error:

"Reverse for 'registration_register' with arguments '()' and keyword arguments '{}' not found."

I assume it's because on line 81, it's looking for "registration_register", which doesn't exist in urls.py

The same happens for "auth_login" on line 81 as well.

Can you please advise what I need to do to overcome this problem?

thanks,
Mark

Test failure in django.contrib.auth.tests related to permissions

I am trying to integrate PyBBM into an existing project. After doing so I have started getting errors when running the full Django project test suite, see below.

With a cursory look, I believe the user_saved signal handler is adding pybb permissions to the users created in the django.contrib.auth.tests. This is the right thing to do, but the django.contrib.auth.tests are not prepared to handle.

Do you have an idea's on how to fix or isolate them?

FAIL: test_custom_perms (django.contrib.auth.tests.auth_backends.BackendTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "venv/lib/python2.7/site-packages/django/contrib/auth/tests/auth_backends.py", line 53, in test_custom_perms
    self.assertEqual(user.get_all_permissions() == set([u'auth.test']), True)
AssertionError: False != True

======================================================================
FAIL: test_has_no_object_perm (django.contrib.auth.tests.auth_backends.BackendTest)
Regressiontest for #12462
----------------------------------------------------------------------
Traceback (most recent call last):
  File "venv/lib/python2.7/site-packages/django/contrib/auth/tests/auth_backends.py", line 94, in test_has_no_object_perm
    self.assertEqual(user.get_all_permissions(), set(['auth.test']))
AssertionError: Items in the first set but not the second:
u'pybb.add_topic'
u'pybb.add_post'

======================================================================
FAIL: test_get_all_permissions (django.contrib.auth.tests.auth_backends.RowlevelBackendTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "venv/lib/python2.7/site-packages/django/contrib/auth/tests/auth_backends.py", line 189, in test_get_all_permissions
    self.assertEqual(self.user2.get_all_permissions(), set([]))
AssertionError: Items in the first set but not the second:
u'pybb.add_topic'
u'pybb.add_post'

----------------------------------------------------------------------

Multiple topics being returned

https://dpaste.de/wVJFb/
Traceback above.
I have checked the database, only one occurrence of 14 exists. I ( a superuser ) can post with no issues. It's users, they are receiving a 500 error. Haven't been able to track down the error. Hoping some more light can be shed here.

multiple rows for forum/topic readtracker user_id/forum_id (or topic_id)

Hi,

On our installation, sometime, we end up with multiple row for a combination of user and forum or topic.
This raise the following error:
*MultipleObjectsReturned: get() returned more than one TopicReadTracker -- it returned 2! *

Any idea why?

Also, why not adding a unique_together for thoses 2 models?

Thanks,

Seb

ImproperlyConfigured ProfileAdmin

Hello,

When i include pybbm in my django project i've got this problem.

ImproperlyConfigured at /forum/
'ProfileAdmin.raw_id_fields[0]', 'user' must be either a ForeignKey or ManyToManyField.

I was searching in code where is the error.

I found that the ProfileAdmin register the "user" as "raw_id_fields" and the profile use an AutoOneToOnefield on the user.

And I have custom site profile that contains all field from class PybbProfile
Is that Normal ?

[discussion] Read trackers improvements

Now I'm working on #62 issue and realize that our system of read tracker with two models too complicated and when we mark topic as readed and when we determine readed topic/forum or not.
I suggest new system of tracker:

  1. Completely remove ForumReadTracker.
  2. Leave TopicReadTracker with same structure with following meanings:
  • no tracker - not readed topic
  • tracker with timestamp < topic.updated - not readed topic
  • tracker with timestamp >= topic.updated - readed topic
    1. Forum readed when count(trackers.timestamp >= topic.updated) == count(forum.topics)
    2. Actions with trackers:
  • visit topic - update tracker's timestamp with current datetime (or create new)
  • add/remove/update topic - no action
  • forum change - no action
  • Read all topics/topics in category/topics in forum - create trackers for all topics with current timestamp

What additional steps we have to do:
Make migrations and update tests for new behavior

One side effect - growing of count of rows in trackers table.
I will try to write patch today to clear my suggestion.
What do you think guys?

forum language

Please remove the language switching in the middleware.
This is must be an option in the setting.

For example, I want in my site a drop down to switch language, it is not working, because the middleware always overwrite it.

'Transaction managed block ended with pending COMMIT/ROLLBACK'

For some reason when I try to add a post, I'm getting this error. I can't figure out why, but it must not be successful for some reason:

class PostEditMixin(object):

    def get_form_class(self):
        if self.request.user.is_staff:
            return AdminPostForm
        else:
            return PostForm

    def get_context_data(self, **kwargs):
        ctx = super(PostEditMixin, self).get_context_data(**kwargs)
        if defaults.PYBB_ATTACHMENT_ENABLE and (not 'aformset' in kwargs):
            ctx['aformset'] = AttachmentFormSet(instance=self.object if getattr(self, 'object') else None)
        if 'pollformset' not in kwargs:
            ctx['pollformset'] = PollAnswerFormSet(instance=self.object.topic if getattr(self, 'object') else None)
        return ctx

    def form_valid(self, form):
        success = True
        with transaction.commit_manually():
            self.object = form.save()

            if defaults.PYBB_ATTACHMENT_ENABLE:
                aformset = AttachmentFormSet(self.request.POST, self.request.FILES, instance=self.object)
                if aformset.is_valid():
                    aformset.save()
                else:
                    success = False
            else:
                aformset = AttachmentFormSet()

            if self.object.topic.poll_type != Topic.POLL_TYPE_NONE and self.object.topic.head == self.object:
                pollformset = PollAnswerFormSet(self.request.POST, instance=self.object.topic)
                if pollformset.is_valid():
                    pollformset.save()
                else:
                    success = False
            else:
                self.object.topic.poll_question = None
                self.object.topic.save()
                self.object.topic.poll_answers.all().delete()
                pollformset = PollAnswerFormSet()

            if success:
                transaction.commit()
                return super(ModelFormMixin, self).form_valid(form)
            else:
                transaction.rollback()
                return self.render_to_response(self.get_context_data(form=form, aformset=aformset, pollformset=pollformset))

Here's my error:

TransactionManagementError at /forum/forum/1/topic/add/
Transaction managed block ended with pending COMMIT/ROLLBACK

Let me know if I need to get more specific, I don't really know what else I could have done wrong.

PyBBM base template renders incorrectly

I'm reporting here, since pybbm.org forums seem spammed into oblivion.

Did everything as described in install docs. I've added following variable to settings.py:

PYBB_TEMPLATE = 'forum.html'

The template is dead simple, only accounting for page title and content block:

{% extends 'base.html' %}
{% block head %}<title>Forum</title>{% endblock %}
{% block body %}
    {% block content %}{% endblock %}
{% endblock %}

And the base.html template is:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    {% block head %}{% endblock %}
</head>
<body>
    {% block body %}{% endblock %}
</body>
</html>

But when I access /forum on my development server, the page renders as if the forum.html didn't extend base.html at all:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<body>

</body>
</html>

I should add that it renders correctly (with title tag present) when used in a generic view.

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.