Пример #1
0
    def submit_form(self, form, target):
        new_forum = Forum(
                          name=form.cleaned_data['name'],
                          slug=slugify(form.cleaned_data['name']),
                          redirect=form.cleaned_data['redirect'],
                          style=form.cleaned_data['style'],
                          type='redirect',
                          )
        new_forum.set_description(form.cleaned_data['description'])
        new_forum.insert_at(form.cleaned_data['parent'], position='last-child', save=True)
        Forum.objects.populate_tree(True)

        if form.cleaned_data['perms']:
            new_forum.copy_permissions(form.cleaned_data['perms'])
            self.request.monitor['acl_version'] = int(self.request.monitor['acl_version']) + 1

        return new_forum, Message(_('New Redirect has been created.'), 'success')
Пример #2
0
    def submit_form(self, form, target):
        new_forum = Forum(
                          name=form.cleaned_data['name'],
                          slug=slugify(form.cleaned_data['name']),
                          type='forum',
                          attrs=form.cleaned_data['attrs'],
                          show_details=form.cleaned_data['show_details'],
                          style=form.cleaned_data['style'],
                          closed=form.cleaned_data['closed'],
                          prune_start=form.cleaned_data['prune_start'],
                          prune_last=form.cleaned_data['prune_last'],
                          )
        new_forum.set_description(form.cleaned_data['description'])
        new_forum.insert_at(form.cleaned_data['parent'], position='last-child', save=True)
        Forum.objects.populate_tree(True)

        if form.cleaned_data['perms']:
            new_forum.copy_permissions(form.cleaned_data['perms'])
            self.request.monitor['acl_version'] = int(self.request.monitor['acl_version']) + 1

        return new_forum, Message(_('New Forum has been created.'), 'success')