mirror of
https://github.com/kennethreitz/photos.kennethreitz.org.git
synced 2026-06-05 06:46:13 +00:00
54bd5bc122
- Remove groups app and multi-user features (user listing, registration, @username profiles, SINGLE_TENANT toggle) - Switch from JWT/localStorage auth to Django session auth - Replace Alpine.js with HTMX + vanilla JS where needed - Add SiteConfig model for customizable site title/tagline - Add photo manager page (/manage/) with multi-select and bulk actions - Add python-dotenv so manage.py loads .env automatically - Server-render dashboard, search, collections (no client-side framework) - Keep vanilla JS only for upload (drag-drop/progress) and manage (multi-select) - Simplify gallery URLs from /@username/collections/ to /collections/ - Clean up API: remove groups/users endpoints, add /images/manage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
61 lines
1.9 KiB
Python
61 lines
1.9 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
|
|
|
|
from core.models import Camera, ExifData, Image, Lens, SiteConfig, User
|
|
|
|
|
|
@admin.register(SiteConfig)
|
|
class SiteConfigAdmin(admin.ModelAdmin):
|
|
list_display = ['site_title', 'tagline']
|
|
|
|
def has_add_permission(self, request):
|
|
return not SiteConfig.objects.exists()
|
|
|
|
def has_delete_permission(self, request, obj=None):
|
|
return False
|
|
|
|
|
|
@admin.register(User)
|
|
class UserAdmin(BaseUserAdmin):
|
|
list_display = ['username', 'email', 'date_joined', 'is_staff']
|
|
fieldsets = BaseUserAdmin.fieldsets + (
|
|
("Profile", {'fields': ('bio', 'avatar', 'website')}),
|
|
)
|
|
|
|
|
|
@admin.register(Camera)
|
|
class CameraAdmin(admin.ModelAdmin):
|
|
list_display = ['display_name', 'manufacturer', 'model', 'slug']
|
|
list_filter = ['manufacturer']
|
|
search_fields = ['manufacturer', 'model', 'display_name']
|
|
prepopulated_fields = {'slug': ('manufacturer', 'model')}
|
|
|
|
|
|
@admin.register(Lens)
|
|
class LensAdmin(admin.ModelAdmin):
|
|
list_display = ['display_name', 'manufacturer', 'model', 'max_aperture', 'slug']
|
|
list_filter = ['manufacturer']
|
|
search_fields = ['manufacturer', 'model', 'display_name']
|
|
prepopulated_fields = {'slug': ('manufacturer', 'model')}
|
|
|
|
|
|
class ExifDataInline(admin.StackedInline):
|
|
model = ExifData
|
|
extra = 0
|
|
readonly_fields = ['raw_data']
|
|
|
|
|
|
@admin.register(Image)
|
|
class ImageAdmin(admin.ModelAdmin):
|
|
list_display = ['title', 'user', 'visibility', 'is_processing', 'upload_date']
|
|
list_filter = ['visibility', 'is_processing']
|
|
search_fields = ['title', 'description', 'user__username']
|
|
inlines = [ExifDataInline]
|
|
|
|
|
|
@admin.register(ExifData)
|
|
class ExifDataAdmin(admin.ModelAdmin):
|
|
list_display = ['image', 'camera', 'lens', 'focal_length', 'aperture', 'iso', 'date_taken']
|
|
list_filter = ['camera', 'lens']
|
|
search_fields = ['image__title', 'camera__display_name', 'lens__display_name']
|