Beispiel #1
0
def run():
    from forum.models import Category

    forum_category_1 = Category()
    forum_category_1.name = u'Radio'
    forum_category_1.sort_order = 0
    forum_category_1.save()

    from forum.models import Forum

    forum_forum_1 = Forum()
    forum_forum_1.title = u'Radio forum'
    forum_forum_1.slug = u'radio-forum'
    forum_forum_1.parent = None
    forum_forum_1.description = u'Stuff about the radio.'
    forum_forum_1.threads = 0
    forum_forum_1.posts = 0
    forum_forum_1.category = forum_category_1
    forum_forum_1.anonymous = False
    forum_forum_1.sort_order = 0
    forum_forum_1.save()

    from forum.models import Thread


    from forum.models import Post


    from forum.models import Subscription


    from forum.models import LastRead
Beispiel #2
0
def new_forum(request):
    form = ForumForm()
    
    if request.method == 'POST':
        form = ForumForm(request.POST)

        if form.is_valid():
            forum = Forum()
            forum.slug = form.cleaned_data['slug']
            forum.description = form.cleaned_data['description']
            forum.creator = request.user

            forum.save()

            return HttpResponseRedirect(reverse('forum:forum-home', ))

    context = get_base_context()
    context['form'] = form
    return render(request, 'forum/new-forum.html', context)
Beispiel #3
0
def new_forum(request):
    form = ForumForm()

    if request.method == 'POST':
        form = ForumForm(request.POST)

        if form.is_valid():

            forum = Forum()
            forum.title = form.cleaned_data['title']
            forum.description = form.cleaned_data['description']

            forum.creator = request.user

            forum.save()

            return HttpResponseRedirect(reverse('forum:forum-index'))

    return render(
        request,
        'forum/new-forum.html',
        {'form': form},
    )