mirror of
https://github.com/django/django.git
synced 2025-10-30 00:56:09 +00:00
Fixed #13196 -- Formatting in admin changelists.
Handled values returned by functions more like field values. In particular, localized dates, times and datetimes properly, and converted datetimes to the current timezone.
This commit is contained in:
@@ -3,8 +3,8 @@ from __future__ import absolute_import
|
||||
from django.contrib import admin
|
||||
from django.core.paginator import Paginator
|
||||
|
||||
from .models import (Child, Parent, Genre, Band, Musician, Group, Quartet,
|
||||
Membership, ChordsMusician, ChordsBand, Invitation, Swallow)
|
||||
from .models import (Event, Child, Parent, Genre, Band, Musician, Group,
|
||||
Quartet, Membership, ChordsMusician, ChordsBand, Invitation, Swallow)
|
||||
|
||||
|
||||
site = admin.AdminSite(name="admin")
|
||||
@@ -15,6 +15,15 @@ class CustomPaginator(Paginator):
|
||||
allow_empty_first_page=allow_empty_first_page)
|
||||
|
||||
|
||||
class EventAdmin(admin.ModelAdmin):
|
||||
list_display = ['event_date_func']
|
||||
|
||||
def event_date_func(self, event):
|
||||
return event.date
|
||||
|
||||
site.register(Event, EventAdmin)
|
||||
|
||||
|
||||
class ParentAdmin(admin.ModelAdmin):
|
||||
list_filter = ['child__name']
|
||||
search_fields = ['child__name']
|
||||
|
||||
Reference in New Issue
Block a user