Opened 4 years ago

Last modified 2 years ago

#29682 closed Bug

Error in view permission with custom model form field — at Initial Version

Reported by: Jones Owned by: nobody
Component: contrib.admin Version: 2.1
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

  • Set permission to user with only view to model
  • Create field in form class
  • Go to django admin view un object created
class ModelAForm(forms.ModelForm):

    class Meta:
        model = ModelA
        fields = '__all__'

    form_field = forms.BooleanField(
        label="Form Field",
        required=False,
        widget=forms.CheckboxInput()
    )


class ModelA(models.Model):
    test = models.IntegerField(
        null=True,
        blank=True
    )

@admin.register(ModelA)
class ModelAAdmin(admin.ModelAdmin):

    form = TestForm

    fieldsets = (
        ('Test', {
            'fields': (
                'test', 'form_field'
            )
        }),
    )

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top