mirror of
https://github.com/thecyberlearn/hostinger-django-demo.git
synced 2026-08-18 07:52:56 +00:00
🎉 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
22 lines
707 B
Python
22 lines
707 B
Python
from django.contrib import admin
|
|
from .models import Contact, BlogPost
|
|
|
|
|
|
@admin.register(Contact)
|
|
class ContactAdmin(admin.ModelAdmin):
|
|
list_display = ['name', 'email', 'subject', 'created_at']
|
|
list_filter = ['created_at']
|
|
search_fields = ['name', 'email', 'subject']
|
|
readonly_fields = ['created_at']
|
|
ordering = ['-created_at']
|
|
|
|
|
|
@admin.register(BlogPost)
|
|
class BlogPostAdmin(admin.ModelAdmin):
|
|
list_display = ['title', 'is_published', 'created_at', 'updated_at']
|
|
list_filter = ['is_published', 'created_at']
|
|
search_fields = ['title', 'content']
|
|
prepopulated_fields = {'slug': ('title',)}
|
|
readonly_fields = ['created_at', 'updated_at']
|
|
ordering = ['-created_at']
|