Django cms plugin POST request

content-management-system, django, plugins, request

Solution

I finally solved my problem. In KomentarzePlugin class I added:

cache = False

Problem

I wrote simple plugin to add comments onto page using form. Here is the plugin code: ``` class KomentarzePlugin(CMSPluginBase): model = CMSPlugin name = _("Komentarze plugin") render_template = "komentarze/komentarze_wtyczka.html" def render(self, context, instance, placeholder): request = context['request'] print 'weszlo1' print request.method if request.method == 'POST': form = KomentarzForm(request.POST) print 'weszlo2' if form.is_valid(): user = form.cleaned_data['user'] tresc = form.cleaned_data['tresc'] strona = request.current_page data = timezone.datetime.now() k = Komentarz(autor=user, data=data, tresc=tresc, strona=strona) k.save() context.update({ 'instance': instance, 'placeholder': placeholder, 'komentarze': Komentarz.objects.all().filter(strona=request.current_page).order_by('-data'), 'forma': KomentarzForm() }) return context plugin_pool.register_plugin(KomentarzePlugin) ``` When I restart server, fill the form with data, hit submit, then if statement with POST method is satisfied and function enters it, post is added to database and shown. But, when I try to do it again, it don't even print request.method to console, which means it is empty. Restarting server fixes the problem. Also it doesn't work when I restart the server, do some random menu clicks, and then try to fill and send the form. Any guess?

Original source