How to use the coderedcms.models.page_models.CoderedSubmissionRevision function in coderedcms

To help you get started, we’ve selected a few coderedcms 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 coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
def create_submission_changed_revision(sender, **kwargs):
    if not issubclass(sender, SessionFormSubmission):
        return
    submission = kwargs['instance']
    created = kwargs['created']
    CoderedSubmissionRevision.create_from_submission(
        submission, (CoderedSubmissionRevision.CREATED if created else CoderedSubmissionRevision.CHANGED))  # noqa
github coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
def create_submission_deleted_revision(sender, **kwargs):
    if not issubclass(sender, CoderedSessionFormSubmission):
        return
    submission = kwargs['instance']
    CoderedSubmissionRevision.create_from_submission(submission, SubmissionRevision.DELETED)  # noqa
github coderedcorp / coderedcms / coderedcms / models / page_models.py View on Github external
def create_normal_submission(self, delete_self=True):
        submission_data = self.get_data()
        if 'user' in submission_data:
            submission_data['user'] = str(submission_data['user'])
        submission = FormSubmission.objects.create(
            form_data=json.dumps(submission_data, cls=StreamFormJSONEncoder),
            page=self.page
        )

        if delete_self:
            CoderedSubmissionRevision.objects.filter(submission_id=self.id).delete()
            self.delete()

        return submission