Allow users to change their own character

This commit is contained in:
Gabriel Augendre 2022-10-31 19:23:37 +01:00
parent 314ef9fc17
commit 87ccc913f8

View file

@ -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):