Esempio n. 1
0
class TagBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
    pk = forms.ModelMultipleChoiceField(queryset=Tag.objects.all(), widget=forms.MultipleHiddenInput)
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
    description = forms.CharField(max_length=200, required=False)

    class Meta:
        nullable_fields = ["description"]
Esempio n. 2
0
class StatusBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
    """Bulk edit/delete form for `Status` objects."""

    pk = forms.ModelMultipleChoiceField(queryset=Status.objects.all(), widget=forms.MultipleHiddenInput)
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
    content_types = MultipleContentTypeField(feature="statuses", required=False, label="Content Type(s)")

    class Meta:
        nullable_fields = []
Esempio n. 3
0
class StatusFilterForm(BootstrapMixin, CustomFieldFilterForm):
    """Filtering/search form for `Status` objects."""

    model = Status
    q = forms.CharField(required=False, label="Search")
    content_types = MultipleContentTypeField(
        feature="statuses", choices_as_strings=True, required=False, label="Content Type(s)"
    )
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
Esempio n. 4
0
class StatusFilterForm(BootstrapMixin, CustomFieldFilterForm):
    """Filtering/search form for `Status` objects."""

    model = Status
    q = forms.CharField(required=False, label="Search")
    content_types = MultipleContentTypeField(
        queryset=ContentType.objects.filter(
            FeatureQuery("statuses").get_query()).order_by(
                "app_label", "model"),
        required=False,
        label="Content type(s)",
        widget=StaticSelect2Multiple(),
    )
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
Esempio n. 5
0
class StatusFilterForm(BootstrapMixin, CustomFieldFilterForm):
    """Filtering/search form for `Status` objects."""

    model = Status
    q = forms.CharField(required=False, label="Search")
    # "CSV" field is being used here because it is using the slug-form input for
    # content-types, which improves UX.
    content_types = CSVMultipleContentTypeField(
        queryset=ContentType.objects.filter(
            FeatureQuery("statuses").get_query()).order_by(
                "app_label", "model"),
        required=False,
        label="Content type(s)",
    )
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
Esempio n. 6
0
class StatusBulkEditForm(BootstrapMixin, CustomFieldBulkEditForm):
    """Bulk edit/delete form for `Status` objects."""

    pk = forms.ModelMultipleChoiceField(queryset=Status.objects.all(),
                                        widget=forms.MultipleHiddenInput)
    color = forms.CharField(max_length=6, required=False, widget=ColorSelect())
    content_types = forms.ModelMultipleChoiceField(
        queryset=ContentType.objects.filter(
            FeatureQuery("statuses").get_query()).order_by(
                "app_label", "model"),
        label="Content type(s)",
        required=False,
    )

    class Meta:
        nullable_fields = []
Esempio n. 7
0
 class Meta:
     model = Status
     widgets = {"color": ColorSelect()}
     fields = ["name", "slug", "description", "content_types", "color"]