Пример #1
0
class WebhookForm(BootstrapMixin, forms.ModelForm):
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('webhooks'))

    class Meta:
        model = Webhook
        fields = '__all__'
        fieldsets = (
            ('Webhook', ('name', 'content_types', 'enabled')),
            ('Events', ('type_create', 'type_update', 'type_delete')),
            ('HTTP Request', (
                'payload_url',
                'http_method',
                'http_content_type',
                'additional_headers',
                'body_template',
                'secret',
            )),
            ('Conditions', ('conditions', )),
            ('SSL', ('ssl_verification', 'ca_file_path')),
        )
        labels = {
            'type_create': 'Creations',
            'type_update': 'Updates',
            'type_delete': 'Deletions',
        }
        widgets = {
            'http_method': StaticSelect(),
            'additional_headers':
            forms.Textarea(attrs={'class': 'font-monospace'}),
            'body_template': forms.Textarea(attrs={'class': 'font-monospace'}),
        }
Пример #2
0
class TagFilterForm(BootstrapMixin, forms.Form):
    model = Tag
    q = forms.CharField(required=False, label=_('Search'))
    content_type_id = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.filter(FeatureQuery('tags').get_query()),
        required=False,
        label=_('Tagged object type'))
Пример #3
0
class WebhookFilterForm(FilterForm):
    field_groups = [
        ['q'],
        ['content_types', 'http_method', 'enabled'],
        ['type_create', 'type_update', 'type_delete'],
    ]
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('webhooks'),
        required=False)
    http_method = forms.MultipleChoiceField(choices=WebhookHttpMethodChoices,
                                            required=False,
                                            widget=StaticSelectMultiple(),
                                            label=_('HTTP method'))
    enabled = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_create = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_update = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_delete = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
Пример #4
0
class WebhookFilterForm(BootstrapMixin, forms.Form):
    field_groups = [
        ['q'],
        ['content_types', 'http_method', 'enabled'],
        ['type_create', 'type_update', 'type_delete'],
    ]
    q = forms.CharField(
        required=False,
        widget=forms.TextInput(attrs={'placeholder': _('All Fields')}),
        label=_('Search'))
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('custom_fields'),
        required=False)
    http_method = forms.MultipleChoiceField(choices=WebhookHttpMethodChoices,
                                            required=False,
                                            widget=StaticSelectMultiple(),
                                            label=_('HTTP method'))
    enabled = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_create = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_update = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
    type_delete = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
Пример #5
0
class WebhookForm(forms.ModelForm):
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('webhooks'))
    payload_url = LaxURLField(label='URL')

    class Meta:
        model = Webhook
        exclude = ()
Пример #6
0
class CustomFieldForm(forms.ModelForm):
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('custom_fields'))

    class Meta:
        model = CustomField
        exclude = []
        widgets = {
            'default': forms.TextInput(),
            'validation_regex': forms.Textarea(attrs={
                'cols': 80,
                'rows': 3,
            })
        }
Пример #7
0
class CustomFieldForm(BootstrapMixin, forms.ModelForm):
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('custom_fields')
    )

    class Meta:
        model = CustomField
        fields = '__all__'
        fieldsets = (
            ('Custom Field', ('name', 'label', 'type', 'weight', 'required', 'description')),
            ('Assigned Models', ('content_types',)),
            ('Behavior', ('filter_logic',)),
            ('Values', ('default', 'choices')),
            ('Validation', ('validation_minimum', 'validation_maximum', 'validation_regex')),
        )
Пример #8
0
class CustomFieldFilterForm(FilterForm):
    field_groups = [
        ['q'],
        ['type', 'content_types'],
        ['weight', 'required'],
    ]
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('custom_fields'),
        required=False)
    type = forms.MultipleChoiceField(choices=CustomFieldTypeChoices,
                                     required=False,
                                     widget=StaticSelectMultiple(),
                                     label=_('Field type'))
    weight = forms.IntegerField(required=False)
    required = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
Пример #9
0
class CustomFieldFilterForm(BootstrapMixin, forms.Form):
    field_groups = [
        ['q'],
        ['type', 'content_types'],
        ['weight', 'required'],
    ]
    q = forms.CharField(
        required=False,
        widget=forms.TextInput(attrs={'placeholder': _('All Fields')}),
        label=_('Search'))
    content_types = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.all(),
        limit_choices_to=FeatureQuery('custom_fields'),
        required=False)
    type = forms.MultipleChoiceField(choices=CustomFieldTypeChoices,
                                     required=False,
                                     widget=StaticSelectMultiple(),
                                     label=_('Field type'))
    weight = forms.IntegerField(required=False)
    required = forms.NullBooleanField(
        required=False,
        widget=StaticSelect(choices=BOOLEAN_WITH_BLANK_CHOICES))
Пример #10
0
class TagFilterForm(FilterForm):
    model = Tag
    content_type_id = ContentTypeMultipleChoiceField(
        queryset=ContentType.objects.filter(FeatureQuery('tags').get_query()),
        required=False,
        label=_('Tagged object type'))