Open ndarville opened 11 years ago
create()
reply()
add()
edit()
report()
merge_thread()
moderate_thread()
move_thread()
remove()
reports()
nonjs()
simple_js()
views.py
user = request.user now = datetime.datetime.now() # UTC? text_html = sanitized_smartdown(text_plain) try: t = Thread.objects.create( title_plain=title_plain, title_html=title_html, author=user, category=category, creation_date=now, latest_reply_date=now) Post.objects.create( thread=t, creation_date=now, author=user, content_plain=text_plain, content_html=text_html) t.subscriber.add(user) except: pass else: # After successful submission category.thread_count += 1 category.post_count += 1 t.post_count += 1 request.user.get_profile().thread_count += 1 request.user.get_profile().post_count += 1 category.save() t.save() request.user.get_profile().save() return HttpResponseRedirect(reverse('forum.views.thread', args=(t.id,)))
try: thread.title_plain = request.POST['title'] thread.title_html = prettify_title(thread.title_plain) thread.save() except: pass else: return HttpResponseRedirect(reverse('forum.views.thread', args=(thread.id,)))
user = request.user now = datetime.datetime.now() # UTC? try: r = Report.objects.create( creation_date=now, author=user, reason_short=title, thread=thread) if "content" in request.POST: r.reason_long_plain = text_plain r.reason_long_html = text_html if object_type == "post": r.post = obj r.save() except: pass else: # After successful submission return HttpResponseRedirect(reverse('forum.views.thread', args=(thread.id,)))
settings.py
#ADMINS = ( # try: # # ('Your Name', 'your_email@example.com'), # (env['ADMIN_NAME'], env['ADMIN_EMAIL']), # except NameError, KeyError: # pass #) # #MANAGERS = ADMINS
https://github.com/ndarville/pony-forum/blob/master/ponyforum/settings.py#L294-300
try: LOCAL_SETTINGS except NameError: try: from local_settings import * except ImportError: pass
create()
reply()
add()
edit()
report()
merge_thread()
moderate_thread()
move_thread()
remove()
reports()
nonjs()
simple_js()
Examples
views.py
create()
add()
report()
settings.py
https://github.com/ndarville/pony-forum/blob/master/ponyforum/settings.py#L294-300