mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-11-22 22:48:03 +01:00
Allow users to change their own character
This commit is contained in:
parent
314ef9fc17
commit
87ccc913f8
1 changed files with 5 additions and 0 deletions
|
@ -173,6 +173,11 @@ class CharacterAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
form = CharacterAdminForm
|
form = CharacterAdminForm
|
||||||
|
|
||||||
|
def has_change_permission(self, request, obj=None):
|
||||||
|
if obj is None:
|
||||||
|
return super().has_change_permission(request, obj)
|
||||||
|
return obj.player == request.user or request.user.is_superuser
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.Weapon)
|
@admin.register(models.Weapon)
|
||||||
class WeaponAdmin(admin.ModelAdmin):
|
class WeaponAdmin(admin.ModelAdmin):
|
||||||
|
|
Loading…
Reference in a new issue