Skip to content

Commit

Permalink
Merge pull request #3789 from timgraham/admin-fields
Browse files Browse the repository at this point in the history
Silenced deprecation warnings on admin forms.
  • Loading branch information
yakky committed Jan 22, 2015
2 parents 9e7e3f3 + bd881f9 commit 584a37b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cms/admin/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

def get_permission_acessor(obj):
User = get_user_model()

if isinstance(obj, (PageUser, User,)):
rel_name = 'user_permissions'
else:
Expand Down Expand Up @@ -113,7 +113,7 @@ def __init__(self, *args, **kwargs):
def clean(self):
cleaned_data = self.cleaned_data
slug = cleaned_data.get('slug', '')

page = self.instance
lang = cleaned_data.get('language', None)
# No language, can not go further, but validation failed already
Expand Down Expand Up @@ -328,7 +328,7 @@ class PagePermissionInlineAdminForm(forms.ModelForm):
"""
Page permission inline admin form used in inline admin. Required, because
user and group queryset must be changed. User can see only users on the same
level or under him in choosen page tree, and users which were created by him,
level or under him in choosen page tree, and users which were created by him,
but aren't assigned to higher page level than current user.
"""
page = forms.ModelChoiceField(Page.objects.all(), label=_('user'), widget=HiddenInput(), required=True)
Expand Down Expand Up @@ -392,7 +392,7 @@ def clean(self):
# check if access for childrens, or descendants is granted
if can_add and self.cleaned_data['grant_on'] == ACCESS_PAGE:
# this is a missconfiguration - user can add/move page to current
# page but after he does this, he will not have permissions to
# page but after he does this, he will not have permissions to
# access this page anymore, so avoid this
raise forms.ValidationError(_("Add page permission requires also "
"access to children, or descendants, otherwise added page "
Expand Down Expand Up @@ -422,6 +422,7 @@ def save(self, commit=True):
return instance

class Meta:
fields = '__all__'
model = PagePermission


Expand All @@ -441,6 +442,7 @@ def clean(self):
return self.cleaned_data

class Meta:
fields = '__all__'
model = GlobalPagePermission


Expand Down Expand Up @@ -483,6 +485,7 @@ class PageUserForm(UserCreationForm, GenericCmsPermissionForm):
'Send email notification to user about username or password change. Requires user email.'))

class Meta:
fields = '__all__'
model = PageUser

def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
Expand Down Expand Up @@ -537,7 +540,7 @@ def clean(self):
return cleaned_data

def save(self, commit=True):
"""Create user, assign him to staff users, and create permissions for
"""Create user, assign him to staff users, and create permissions for
him if required. Also assigns creator to user.
"""
Super = self._password_change and PageUserForm or UserCreationForm
Expand Down

0 comments on commit 584a37b

Please sign in to comment.