def view_broadcast(request, b_id): broadcast = get_object_or_404(Broadcast, pk=b_id) if request.method == "POST": form = SettingBroadcastForm(request.POST, instance=broadcast) if form.is_valid(): form.save() return HttpResponseRedirect(reverse("broadcast")) else: form = SettingBroadcastForm(instance=broadcast) return render_to_response( "message/view_broadcast.html", {"broadcast": broadcast, "form": form}, context_instance=RequestContext(request) )
def broadcast(request): if request.method == "POST": form = SettingBroadcastForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse("broadcast")) else: form = SettingBroadcastForm() broadcasts = Broadcast.objects.all() return render_to_response( "message/broadcast.html", {"broadcasts": broadcasts, "form": form}, context_instance=RequestContext(request) )
def view_broadcast(request, b_id): broadcast = get_object_or_404(Broadcast, pk=b_id) if request.method == "POST": form = SettingBroadcastForm(request.POST, instance=broadcast) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('broadcast')) else: form = SettingBroadcastForm(instance=broadcast) return render_to_response("message/view_broadcast.html", { "broadcast": broadcast, "form": form, }, context_instance=RequestContext(request))
def broadcast(request): if request.method == "POST": form = SettingBroadcastForm(request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('broadcast')) else: form = SettingBroadcastForm() broadcasts = Broadcast.objects.all() return render_to_response("message/broadcast.html", { "broadcasts": broadcasts, "form": form, }, context_instance=RequestContext(request))