How to use the dispatch.apps.manager.forms.FeaturedImageForm function in dispatch

To help you get started, we’ve selected a few dispatch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ubyssey / dispatch / dispatch / apps / manager / forms.py View on Github external
def __init__(self, *args, **kwargs):
        super(ArticleForm, self).__init__(*args, **kwargs)

        # Pass POST data into subforms if available
        if self.data and 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(self.data, instance=self.instance.featured_image)
        elif 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(instance=self.instance.featured_image)
        elif self.data:
            self.featured_image_form = FeaturedImageForm(self.data)
        else:
            self.featured_image_form = FeaturedImageForm()

        if self.data:
            self.save_id = self.data.get('saveid')
        else:
            self.save_id = str(uuid.uuid4())[:8]
github ubyssey / dispatch / dispatch / apps / manager / forms.py View on Github external
def __init__(self, *args, **kwargs):
        super(ArticleForm, self).__init__(*args, **kwargs)

        # Pass POST data into subforms if available
        if self.data and 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(self.data, instance=self.instance.featured_image)
        elif 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(instance=self.instance.featured_image)
        elif self.data:
            self.featured_image_form = FeaturedImageForm(self.data)
        else:
            self.featured_image_form = FeaturedImageForm()

        if self.data:
            self.save_id = self.data.get('saveid')
        else:
            self.save_id = str(uuid.uuid4())[:8]
github ubyssey / dispatch / dispatch / apps / manager / forms.py View on Github external
def save_featured_image(self, revision=True):
        if self.instance.featured_image:
            self.featured_image_form.data = self.data
            if revision:
                self.instance.featured_image.pk = None
                self.featured_image_form.instance = self.instance.featured_image
        else:
            self.featured_image_form = FeaturedImageForm(self.data)
        if self.featured_image_form.is_valid():
            saved = self.featured_image_form.save()
            saved.article = self.instance
            saved.save()
            self.instance.featured_image = saved
github ubyssey / dispatch / dispatch / apps / manager / forms.py View on Github external
def __init__(self, *args, **kwargs):
        super(ArticleForm, self).__init__(*args, **kwargs)

        # Pass POST data into subforms if available
        if self.data and 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(self.data, instance=self.instance.featured_image)
        elif 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(instance=self.instance.featured_image)
        elif self.data:
            self.featured_image_form = FeaturedImageForm(self.data)
        else:
            self.featured_image_form = FeaturedImageForm()

        if self.data:
            self.save_id = self.data.get('saveid')
        else:
            self.save_id = str(uuid.uuid4())[:8]
github ubyssey / dispatch / dispatch / apps / manager / forms.py View on Github external
def __init__(self, *args, **kwargs):
        super(ArticleForm, self).__init__(*args, **kwargs)

        # Pass POST data into subforms if available
        if self.data and 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(self.data, instance=self.instance.featured_image)
        elif 'instance' in kwargs:
            self.featured_image_form = FeaturedImageForm(instance=self.instance.featured_image)
        elif self.data:
            self.featured_image_form = FeaturedImageForm(self.data)
        else:
            self.featured_image_form = FeaturedImageForm()

        if self.data:
            self.save_id = self.data.get('saveid')
        else:
            self.save_id = str(uuid.uuid4())[:8]