mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-18 12:11:11 +00:00
Remove 'Clear choice' action from page chooser in page permissions interface.
This appeared because we reassigned the field's 'widget' attribute after the field was initialised - this means that the field never gets to pass its 'required=True' flag on to the widget. We avoid this by defining the field as a whole, in the Django-approved way (which also means we don't need to override __init__).
This commit is contained in:
parent
e867b48446
commit
7c26217ea0
1 changed files with 2 additions and 4 deletions
|
|
@ -7,7 +7,7 @@ from django.forms.models import inlineformset_factory
|
|||
from wagtail.wagtailcore import hooks
|
||||
from wagtail.wagtailadmin.widgets import AdminPageChooser
|
||||
from wagtail.wagtailusers.models import UserProfile
|
||||
from wagtail.wagtailcore.models import UserPagePermissionsProxy, GroupPagePermission
|
||||
from wagtail.wagtailcore.models import Page, UserPagePermissionsProxy, GroupPagePermission
|
||||
|
||||
|
||||
User = get_user_model()
|
||||
|
|
@ -229,9 +229,7 @@ class GroupForm(forms.ModelForm):
|
|||
|
||||
|
||||
class GroupPagePermissionForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(GroupPagePermissionForm, self).__init__(*args, **kwargs)
|
||||
self.fields['page'].widget = AdminPageChooser()
|
||||
page = forms.ModelChoiceField(queryset=Page.objects.all(), widget=AdminPageChooser())
|
||||
|
||||
class Meta:
|
||||
model = GroupPagePermission
|
||||
|
|
|
|||
Loading…
Reference in a new issue