Ejemplo n.º 1
0
def general_settings(request):
    context = RequestContext(request)
    kbsite = request.kbsite

    form = forms.SiteSettingsForm(instance=kbsite)

    if request.method == 'POST':
        form = forms.SiteSettingsForm(request.POST, instance=kbsite)
        if form.is_valid():
            form.save()
            guest_image = request.FILES.get('guest_image')
            if guest_image:
                pic = models.Picture.objects.create()
                pic.image.save(guest_image.name, guest_image)
                pic.save()
                kbsite.guest_image = pic
                kbsite.save()
            messages.success(request,
                             'Site settings were successfully updated.')
    context['settings_form'] = form

    using_ssl = request.is_secure()
    request_host = request.get_host()
    context['request_host'] = request_host
    context['settings_host'] = kbsite.hostname
    context['request_ssl'] = using_ssl
    context['settings_ssl'] = kbsite.use_ssl

    return render_to_response('kegadmin/index.html', context_instance=context)
Ejemplo n.º 2
0
Archivo: views.py Proyecto: swc/kegbot
def kegadmin_main(request):
  context = RequestContext(request)
  form = forms.SiteSettingsForm(instance=request.kbsite.settings)
  if request.method == 'POST':
    form = forms.SiteSettingsForm(request.POST, instance=request.kbsite.settings)
    if form.is_valid():
      form.save()
      messages.success(request, 'Site settings were successfully updated.')
  context['settings_form'] = form
  return render_to_response('kegadmin/index.html', context)
Ejemplo n.º 3
0
def general_settings(request):
    context = RequestContext(request)
    settings = models.SiteSettings.get()
    form = forms.SiteSettingsForm(instance=settings)
    if request.method == 'POST':
        form = forms.SiteSettingsForm(request.POST, instance=settings)
        if form.is_valid():
            form.save()
            messages.success(request,
                             'Site settings were successfully updated.')
    context['settings_form'] = form
    return render_to_response('kegadmin/index.html', context_instance=context)