Пример #1
0
 def post(self, request, *args, **kwargs):
     #add a node
     folder = request.POST.get('folder', None)
     theme = Themes()
     theme.folder = folder
     theme.save()
     return redirect('/admin/backend/themes')
Пример #2
0
    def parse_themes_section(self):

        themes = self.root.find('themes')
        if themes is not None:
            for theme in themes.findall('theme'):
                theme_folder = theme.get('folder')
                try:
                    website_theme = Themes.objects.get(folder=theme_folder)
                except Themes.DoesNotExist:
                    website_theme = Themes()
                website_theme.folder = theme_folder
                website_theme.save()
Пример #3
0
    def post(self, request, *args, **kwargs):
        #add a node
        postData = json.loads(request.body)
        folder = postData.get('folder', None)
        default = postData.get('default',False)
        if default == "true":
            default = True
        else:
            default = False

        theme = Themes()
        theme.folder = folder
        theme.default = default
        theme.save()
        context_data = {
            "id":theme.id
        }
        return self.render_to_response(context=context_data)