org.forms.extensions

Attributes

FormT

Classes

CoordinatesFormExtension

Enables the extension of form definitions/submissions.

SubmitterFormExtension

Enables the extension of form definitions/submissions.

CommentFormExtension

Enables the extension of form definitions/submissions.

ChangeRequestFormExtension

Enables the extension of form definitions/submissions.

PublicationFormExtension

Can be used with TimezonePublicationMixin or UTCDateTime type decorator.

HoneyPotFormExtension

Enables the extension of form definitions/submissions.

Module Contents

org.forms.extensions.FormT[source]
class org.forms.extensions.CoordinatesFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Enables the extension of form definitions/submissions.

When either of those models create a form class they will take the ‘extensions’ key in the meta dictionary to extend those formcode based forms.

This allows for specialised behaviour of formcode forms with the drawback that those definitions/submissions are more tightly bound to the code. That is to say code in module A could not use submissions defined by module B unless module B is also present in the path.

To create and register a form extension subclass as follows:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class

Note that you should not change the form_class provided to you. Instead you should subclass it. If you need to change the form class, you need to clone it:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class.clone()

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        class ExtendedForm(self.form_class):
            pass

        return ExtendedForm

Also, names must be unique and can only be registered once.

create() type[FormT][source]
class org.forms.extensions.SubmitterFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Enables the extension of form definitions/submissions.

When either of those models create a form class they will take the ‘extensions’ key in the meta dictionary to extend those formcode based forms.

This allows for specialised behaviour of formcode forms with the drawback that those definitions/submissions are more tightly bound to the code. That is to say code in module A could not use submissions defined by module B unless module B is also present in the path.

To create and register a form extension subclass as follows:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class

Note that you should not change the form_class provided to you. Instead you should subclass it. If you need to change the form class, you need to clone it:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class.clone()

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        class ExtendedForm(self.form_class):
            pass

        return ExtendedForm

Also, names must be unique and can only be registered once.

create() type[FormT][source]
class org.forms.extensions.CommentFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Enables the extension of form definitions/submissions.

When either of those models create a form class they will take the ‘extensions’ key in the meta dictionary to extend those formcode based forms.

This allows for specialised behaviour of formcode forms with the drawback that those definitions/submissions are more tightly bound to the code. That is to say code in module A could not use submissions defined by module B unless module B is also present in the path.

To create and register a form extension subclass as follows:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class

Note that you should not change the form_class provided to you. Instead you should subclass it. If you need to change the form class, you need to clone it:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class.clone()

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        class ExtendedForm(self.form_class):
            pass

        return ExtendedForm

Also, names must be unique and can only be registered once.

create() type[FormT][source]
class org.forms.extensions.ChangeRequestFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Enables the extension of form definitions/submissions.

When either of those models create a form class they will take the ‘extensions’ key in the meta dictionary to extend those formcode based forms.

This allows for specialised behaviour of formcode forms with the drawback that those definitions/submissions are more tightly bound to the code. That is to say code in module A could not use submissions defined by module B unless module B is also present in the path.

To create and register a form extension subclass as follows:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class

Note that you should not change the form_class provided to you. Instead you should subclass it. If you need to change the form class, you need to clone it:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class.clone()

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        class ExtendedForm(self.form_class):
            pass

        return ExtendedForm

Also, names must be unique and can only be registered once.

create() type[FormT][source]
class org.forms.extensions.PublicationFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Can be used with TimezonePublicationMixin or UTCDateTime type decorator.

create(timezone: str = 'Europe/Zurich') type[FormT][source]
class org.forms.extensions.HoneyPotFormExtension(form_class: type[_FormT])[source]

Bases: onegov.form.extensions.FormExtension[FormT]

Enables the extension of form definitions/submissions.

When either of those models create a form class they will take the ‘extensions’ key in the meta dictionary to extend those formcode based forms.

This allows for specialised behaviour of formcode forms with the drawback that those definitions/submissions are more tightly bound to the code. That is to say code in module A could not use submissions defined by module B unless module B is also present in the path.

To create and register a form extension subclass as follows:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class

Note that you should not change the form_class provided to you. Instead you should subclass it. If you need to change the form class, you need to clone it:

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        return self.form_class.clone()

class MyExtension(FormExtension, name='my-extension'):
    def create(self):
        class ExtendedForm(self.form_class):
            pass

        return ExtendedForm

Also, names must be unique and can only be registered once.

create() type[FormT][source]