def games(request): switchboard = GamesSwitchboard() if request.method == "POST": for group in (switchboard,): for s in group.props(): val = request.POST.get(s.name, '') s.set_value(val) return render_to_response('cpanel/customization.html', {'settings': (switchboard,), 'module': 'games'}, context_instance=RequestContext(request))
class GamesView(TemplateView): template_name = 'cpanel/games_home.html' def dispatch(self, request, *args, **kwargs): self.switchboard = GamesSwitchboard() return super(GamesView, self).dispatch(request, *args, **kwargs) def post(self, request, *args, **kwargs): self.switchboard = GamesSwitchboard() for s in self.switchboard.props(): val = request.POST.get(s.name, '') s.set_value(val) return redirect('games_home') def get_context_data(self, **kwargs): context = super(GamesView, self).get_context_data(**kwargs) context.update(dict(settings=self.switchboard)) return context
class GamesView(TemplateView): template_name = 'cpanel/customization/games.html' def __init__(self, **kwargs): super(GamesView, self).__init__(**kwargs) self.switchboard = GamesSwitchboard() def post(self, request, *args, **kwargs): for s in self.switchboard.props(): val = request.POST.get(s.name, '') s.set_value(val) return redirect('customization_games') def get_context_data(self, **kwargs): context = super(GamesView, self).get_context_data(**kwargs) context.update(dict(settings=self.switchboard)) return context
def post(self, request, *args, **kwargs): self.switchboard = GamesSwitchboard() for s in self.switchboard.props(): val = request.POST.get(s.name, '') s.set_value(val) return redirect('games_home')
def dispatch(self, request, *args, **kwargs): self.switchboard = GamesSwitchboard() return super(GamesView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, **kwargs): context = super(GamesView, self).get_context_data(**kwargs) switchboard = GamesSwitchboard() context.update(dict(settings=(switchboard, ))) return context
def __init__(self, **kwargs): super(GamesView, self).__init__(**kwargs) self.switchboard = GamesSwitchboard()