Nobody?
On 23 mar, 19:20, Jônatas Vieira <[email protected]> wrote: > Hi there. > > I'm having a weird issue with a custom admin action. It works pretty > fine locally, but on the live server what happens is: > > * it renders to the template - OK > * after submit, the function is executed (the changes and everything > are applied using the post data, collected from the template) - OK > * then, on debug = True mode, it crashes with a "page not found" > error; after then, I either need to clear all my cookies or, in most > of times, need to restart the browser, otherwise the whole site is > unaccessible to me, with the same "page not found" error, always > listing my urls from the main urls.py. > > I want to make clear that it redirects, after post, to the very same > url it was before, all urls are valid (remember it works PERFECTLY on > my local server), but no one seems to work after the issue, only after > I restart my browser and clear my data. > > Here goes, as example, the admin.py code I'm using: > > class SectorAdmin(admin.ModelAdmin): > actions = ['apply_index'] > > def apply_index(self, request, queryset): > form = None > > if 'apply' in request.POST: > form = ApplyIndexForm(request.POST) > > if form.is_valid(): > index = form.cleaned_data['index'] > > sector_names = [] > for sector in queryset: > sector.index_change(index) > sector_names.append(sector.name) > > self.message_user(request, "Index of %s%% successfully > applied to %s." % (index, ', '.join(sector_names))) > return HttpResponseRedirect(request.get_full_path()) > > if not form: > form = ApplyIndexForm(initial={'_selected_action': > request.POST.getlist(admin.ACTION_CHECKBOX_NAME)}) > > VARS = { > 'sectors': queryset, > 'apply_form': form, > } > > return render_to_response('admin/heritage/sector/ > apply_index.html', VARS, context_instance=RequestContext(request)) > apply_index.short_description = "Apply new sector index" > > admin.site.register(Sector, SectorAdmin) > > Does anybody know what this could be? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

