Skip to content

Commit

Permalink
Merge branch 'master' of github.com:vicalloy/LBForum
Browse files Browse the repository at this point in the history
  • Loading branch information
vicalloy committed Aug 21, 2011
2 parents f7991e6 + 8f89ae6 commit a8d5c19
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 3 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include README.rst
include LICENSE
include MANIFEST.in
include requirements.txt
recursive-include lbforum/locale *
recursive-include lbforum/templates *.html
recursive-include lbforum/templates_v2ex *.html
Expand Down
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Requirements
* django-simple-avatar_

.. _`Python 2.5+`: http://python.org/
.. _`Django 1.2+`: http://www.djangoproject.com/
.. _`Django 1.3+`: http://www.djangoproject.com/
.. _PIL: http://www.pythonware.com/products/pil/
.. _django-pagination: http://code.google.com/p/django-pagination/
.. _`south 0.7.2+`: http://south.aeracode.org/
Expand Down Expand Up @@ -74,6 +74,12 @@ Installation
Configuration
-------------

Config urls.py::

(r'^attachments/', include('attachments.urls')),
(r'^', include('lbforum.urls')),


The LBForum has some settings should be set in `settings.py`:

#. Add the following app to ``INSTALLED_APPS``::
Expand Down
2 changes: 1 addition & 1 deletion lbforum/static/lbforum/styles/Oxygen/Oxygen.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ body {
.brd samp, .brd code, .brd pre, .brd option, .brd optgroup,
.brd input, .brd select, .brd textarea, .brd td, .brd th {
font-family: Verdana,Helvetica,Arial,sans-serif;
font-size: 1em;
font-size: 1.084em;
font-style: normal;
font-weight: normal;
}
Expand Down
8 changes: 8 additions & 0 deletions lbforum/templates/lbforum/inc_announce.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@
</div>
</div>
{% endif %}

{% if messages %}
<ul class="brd-messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
{% endfor %}
</ul>
{% endif %}
42 changes: 42 additions & 0 deletions lbforum/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.utils.translation import ugettext_lazy as _
from django.core.urlresolvers import reverse
from django.contrib.csrf.middleware import csrf_exempt
from django.contrib import messages

from forms import EditPostForm, NewPostForm, ForumForm
from models import Topic, Forum, Post
Expand Down Expand Up @@ -103,6 +104,7 @@ def new_post(request, forum_id=None, topic_id=None, form_class=NewPostForm, \

@login_required
def edit_post(request, post_id, form_class=EditPostForm, template_name="lbforum/post.html"):
#TODO permission
preview = None
post_type = _('reply')
edit_post = get_object_or_404(Post, id=post_id)
Expand Down Expand Up @@ -134,6 +136,46 @@ def user_posts(request, user_id, template_name='lbforum/account/user_posts.html'
view_user = User.objects.get(pk=user_id)
posts = view_user.post_set.order_by('-created_on').select_related()
return render(request, template_name, {'posts': posts, 'view_user': view_user})

@login_required
def delete_topic(request, topic_id):
if not request.user.is_staff:
messages.error(_('no right'))
return HttpResponseRedirect(request.path)
topic = get_object_or_404(Topic, id = topic_id)
forum = topic.forum
topic.delete()
#TODO update forum count...
return HttpResponseRedirect(reverse("lbforum_forum", args=[forum.slug]))

@login_required
def delete_post(request, post_id):
if not request.user.is_staff:
messages.error(_('no right'))
return HttpResponseRedirect(request.path)
post = get_object_or_404(Post, id=post_id)
topic = post.topic
post.delete()
#TODO update forum/topic count...
#return HttpResponseRedirect(request.path)
return HttpResponseRedirect(reverse("lbforum_topic", args=[topic.id]))

@login_required
def update_topic_attr_as_not(request, topic_id, attr):
if not request.user.is_staff:
messages.error(_('no right'))
return HttpResponseRedirect(request.path)
topic = get_object_or_404(Topic, id = topic_id)
if attr == 'sticky':
topic.sticky = not topic.sticky
elif attr == 'closed':
topic.closed = not topic.closed
elif attr == 'hidden':
topic.hidden = not topic.hidden
topic.save()
messages.success(request, _('success'))
return HttpResponseRedirect(reverse("lbforum_topic", args=[topic.id]))

#Feed...
#Add Post
#Add Topic
10 changes: 10 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Django>=1.3
django-helper>=0.8.1
django-lb-attachments>=0.8
django-onlineuser>=0.8
django-simple-avatar>=0.8.1
BeautifulSoup
postmarkup
django-pagination
PIL
south>=0.7.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def fullsplit(path, result=None):
packages = packages,
cmdclass = cmdclasses,
install_requires=[
"Django>=1.2",
"Django>=1.3",
"django-helper>=0.8.1",
"django-lb-attachments>=0.8",
"django-onlineuser>=0.8",
Expand Down

0 comments on commit a8d5c19

Please sign in to comment.