def admin_edit(self, key):
        model = Setting.factory(key)
        instance = model.get_instance()

        self.meta.Model = model
        self.scaffold.ModelForm = ferris.model_form(model)

        self.context['settings_class'] = model

        return ferris.scaffold.edit(self, instance.key.urlsafe())
Beispiel #2
0
    def admin_edit(self, key):
        model = Setting.factory(key)
        instance = model.get_instance()

        self.meta.Model = model
        self.scaffold.ModelForm = ferris.model_form(model)

        self.context['settings_class'] = model

        return ferris.scaffold.edit(self, instance.key.urlsafe())
    def admin_edit(self, key):
        model = Setting.factory(key)
        instance = model.get_instance(static_settings=ferris.settings.settings())

        self.meta.Model = model
        self.scaffold.ModelForm = ferris.model_form(model)

        self.context['settings_class'] = model

        def reload_settings(**kwargs):
            self.components.flash_messages('Settings saved, however, the settings may not be updated on all instances. You may have to restart instances for the settings to take effect.', 'warning')

        self.events.scaffold_after_save += reload_settings

        return ferris.scaffold.edit(self, instance.key.urlsafe())
Beispiel #4
0
    def admin_edit(self, key):
        model = Setting.factory(key)
        instance = model.get_instance(
            static_settings=ferris.settings.settings())

        self.meta.Model = model
        self.scaffold.ModelForm = ferris.model_form(model)

        self.context['settings_class'] = model

        def reload_settings(**kwargs):
            self.components.flash_messages(
                'Settings saved, however, the settings may not be updated on all instances. You may have to restart instances for the settings to take effect.',
                'warning')

        self.events.scaffold_after_save += reload_settings

        return ferris.scaffold.edit(self, instance.key.urlsafe())
Beispiel #5
0
 def add(self):
     AnswerForm = model_form(self.meta.Model, exclude=("votes",))
     self.scaffold.ModelForm = AnswerForm 
     returnKey = scaffold.add(self)
     time.sleep(0.1)     # in order to let item can be queried immediately after adding
     return returnKey
Beispiel #6
0
 class Scaffold:
     """ global configuration """
     # properties of model to show to user when controlling model
     # [!] if only property to show, add comma at the end. e.g.: =("title",)
     display_properties = ("content", "created_by", "votes")
     ModelForm = model_form(Answer, only=("content",))