Changed has_perms() to has_perm(), because the former always returns False...

main
Jaap Joris Vens 2020-05-20 18:03:53 +02:00
rodzic 257a51cb57
commit 11fa5ba39b
2 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -31,7 +31,7 @@ def editsection(context, inner):
user = context['request'].user user = context['request'].user
app_label = section._meta.app_label app_label = section._meta.app_label
model_name = section._meta.model_name model_name = section._meta.model_name
if user.has_perms(f'{app_label}_{model_name}_change'): if user.has_perm(f'{app_label}.change_{model_name}'):
slug = section.page.slug slug = section.page.slug
number = section.number number = section.number
url = reverse('cms:updatesection', args=[slug, number]) if slug else reverse('cms:updatesection', args=[number]) url = reverse('cms:updatesection', args=[slug, number]) if slug else reverse('cms:updatesection', args=[number])
@ -45,7 +45,7 @@ def editpage(context, inner):
user = context['request'].user user = context['request'].user
app_label = page._meta.app_label app_label = page._meta.app_label
model_name = page._meta.model_name model_name = page._meta.model_name
if user.has_perms(f'{app_label}_{model_name}_change'): if user.has_perm(f'{app_label}.change_{model_name}'):
slug = page.slug slug = page.slug
url = reverse('cms:updatepage', args=[slug]) if slug else reverse('cms:updatepage') url = reverse('cms:updatepage', args=[slug]) if slug else reverse('cms:updatepage')
return mark_safe(f'<a class="edit page" href="{url}">{inner}</a>') return mark_safe(f'<a class="edit page" href="{url}">{inner}</a>')

Wyświetl plik

@ -70,7 +70,7 @@ a.section.edit {
} }
} }
// Will be supported in the near future! :) // Will be supported in the near future! :)
section:has(> a.edit) { section:has(> a.edit):hover {
background: #eee; background: #eee;
} }