mirror of
https://github.com/Crocmagnon/charasheet.git
synced 2024-12-22 22:01:48 +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
|
||||
|
||||
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)
|
||||
class WeaponAdmin(admin.ModelAdmin):
|
||||
|
|
Loading…
Reference in a new issue