mirror of
https://github.com/thecyberlearn/quantum-ai.git
synced 2026-08-18 12:53:00 +00:00
🔧 Fix admin 'page not found' issue
- Fix LOGIN_REDIRECT_URL to redirect to /admin/ instead of homepage - Create admin.py for agent_base to register BaseAgent model - This ensures users stay in admin interface after login - Admin will now show all agents and user management Fixes the issue where admin login worked but redirected to homepage. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
7b0e166adf
commit
1b0ec5f856
29
agent_base/admin.py
Normal file
29
agent_base/admin.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
from django.contrib import admin
|
||||||
|
from .models import BaseAgent
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(BaseAgent)
|
||||||
|
class BaseAgentAdmin(admin.ModelAdmin):
|
||||||
|
list_display = ['name', 'slug', 'is_active', 'cost_per_request', 'created_at']
|
||||||
|
list_filter = ['is_active', 'agent_type', 'created_at']
|
||||||
|
search_fields = ['name', 'slug', 'description']
|
||||||
|
readonly_fields = ['slug', 'created_at', 'updated_at']
|
||||||
|
ordering = ['name']
|
||||||
|
|
||||||
|
fieldsets = (
|
||||||
|
('Basic Information', {
|
||||||
|
'fields': ('name', 'slug', 'description', 'agent_type')
|
||||||
|
}),
|
||||||
|
('Configuration', {
|
||||||
|
'fields': ('is_active', 'cost_per_request', 'icon_name')
|
||||||
|
}),
|
||||||
|
('Timestamps', {
|
||||||
|
'fields': ('created_at', 'updated_at'),
|
||||||
|
'classes': ('collapse',)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
def get_readonly_fields(self, request, obj=None):
|
||||||
|
if obj: # editing an existing object
|
||||||
|
return self.readonly_fields + ('agent_type',)
|
||||||
|
return self.readonly_fields
|
||||||
@ -360,7 +360,7 @@ SESSION_SAVE_EVERY_REQUEST = True
|
|||||||
|
|
||||||
# Authentication URLs
|
# Authentication URLs
|
||||||
LOGIN_URL = '/auth/login/'
|
LOGIN_URL = '/auth/login/'
|
||||||
LOGIN_REDIRECT_URL = '/'
|
LOGIN_REDIRECT_URL = '/admin/' # Redirect to admin after admin login
|
||||||
LOGOUT_REDIRECT_URL = '/'
|
LOGOUT_REDIRECT_URL = '/'
|
||||||
|
|
||||||
# Logging Configuration
|
# Logging Configuration
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user