mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Disable adding new records for most EVE API models
This commit is contained in:
@@ -44,12 +44,18 @@ class EVEPlayerCharacterAdmin(admin.ModelAdmin):
|
|||||||
search_fields = ['id', 'name']
|
search_fields = ['id', 'name']
|
||||||
actions = [char_api_update]
|
actions = [char_api_update]
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVEPlayerCharacter, EVEPlayerCharacterAdmin)
|
admin.site.register(EVEPlayerCharacter, EVEPlayerCharacterAdmin)
|
||||||
|
|
||||||
class EVEPlayerCharacterRoleAdmin(admin.ModelAdmin):
|
class EVEPlayerCharacterRoleAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'roleid', 'name')
|
list_display = ('id', 'roleid', 'name')
|
||||||
search_fields = ['roleid', 'name']
|
search_fields = ['roleid', 'name']
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVEPlayerCharacterRole, EVEPlayerCharacterRoleAdmin)
|
admin.site.register(EVEPlayerCharacterRole, EVEPlayerCharacterRoleAdmin)
|
||||||
|
|
||||||
class EVEPlayerCorporationInline(admin.TabularInline):
|
class EVEPlayerCorporationInline(admin.TabularInline):
|
||||||
@@ -57,25 +63,45 @@ class EVEPlayerCorporationInline(admin.TabularInline):
|
|||||||
fields = ('name', 'ticker')
|
fields = ('name', 'ticker')
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class EVEPlayerAllianceAdmin(admin.ModelAdmin):
|
class EVEPlayerAllianceAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'name', 'ticker', 'member_count', 'date_founded')
|
list_display = ('id', 'name', 'ticker', 'member_count', 'date_founded')
|
||||||
search_fields = ['name', 'ticker']
|
search_fields = ['name', 'ticker']
|
||||||
date_hierarchy = 'date_founded'
|
date_hierarchy = 'date_founded'
|
||||||
inlines = [EVEPlayerCorporationInline]
|
inlines = [EVEPlayerCorporationInline]
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVEPlayerAlliance, EVEPlayerAllianceAdmin)
|
admin.site.register(EVEPlayerAlliance, EVEPlayerAllianceAdmin)
|
||||||
|
|
||||||
class EVEPlayerCorporationAdmin(admin.ModelAdmin):
|
class EVEPlayerCorporationAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'name', 'ticker', 'member_count', 'alliance')
|
list_display = ('id', 'name', 'ticker', 'member_count', 'alliance')
|
||||||
search_fields = ['name', 'ticker']
|
search_fields = ['name', 'ticker']
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVEPlayerCorporation, EVEPlayerCorporationAdmin)
|
admin.site.register(EVEPlayerCorporation, EVEPlayerCorporationAdmin)
|
||||||
|
|
||||||
class EVESkillAdmin(admin.ModelAdmin):
|
class EVESkillAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'name', 'group' )
|
list_display = ('id', 'name', 'group' )
|
||||||
search_fields = ['id', 'name']
|
search_fields = ['id', 'name']
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVESkill, EVESkillAdmin)
|
admin.site.register(EVESkill, EVESkillAdmin)
|
||||||
|
|
||||||
class EVESkillGroupAdmin(admin.ModelAdmin):
|
class EVESkillGroupAdmin(admin.ModelAdmin):
|
||||||
list_display = ('id', 'name', )
|
list_display = ('id', 'name', )
|
||||||
search_fields = ['id', 'name']
|
search_fields = ['id', 'name']
|
||||||
|
|
||||||
|
def has_add_permission(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
admin.site.register(EVESkillGroup, EVESkillGroupAdmin)
|
admin.site.register(EVESkillGroup, EVESkillGroupAdmin)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user