Esempio n. 1
0
    def post(self, request):
        """edit the site settings"""
        site = models.SiteSettings.objects.get()
        form = forms.SiteForm(request.POST, request.FILES, instance=site)
        if not form.is_valid():
            data = {"site_form": form}
            return TemplateResponse(request, "settings/site.html", data)
        site = form.save()

        data = {"site_form": forms.SiteForm(instance=site), "success": True}
        return TemplateResponse(request, "settings/site.html", data)
Esempio n. 2
0
 def get(self, request):
     ''' edit form '''
     site = models.SiteSettings.objects.get()
     data = {
         'title': 'Site Settings',
         'site_form': forms.SiteForm(instance=site)
     }
     return TemplateResponse(request, 'settings/site.html', data)
Esempio n. 3
0
    def post(self, request):
        """ edit the site settings """
        site = models.SiteSettings.objects.get()
        form = forms.SiteForm(request.POST, instance=site)
        if not form.is_valid():
            data = {"site_form": form}
            return TemplateResponse(request, "settings/site.html", data)
        form.save()

        return redirect("settings-site")
Esempio n. 4
0
    def post(self, request):
        ''' edit the site settings '''
        site = models.SiteSettings.objects.get()
        form = forms.SiteForm(request.POST, instance=site)
        if not form.is_valid():
            data = {'title': 'Site Settings', 'site_form': form}
            return TemplateResponse(request, 'settings/site.html', data)
        form.save()

        return redirect('settings-site')
Esempio n. 5
0
 def get(self, request):
     """edit form"""
     site = models.SiteSettings.objects.get()
     data = {"site_form": forms.SiteForm(instance=site)}
     return TemplateResponse(request, "settings/site.html", data)