You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
from django.contrib import admin
|
|
|
|
from apps.transaction.models import TransactionParticipant, ParticipantInfo
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
|
|
|
|
class ParticipantInfoInline(admin.StackedInline):
|
|
model = ParticipantInfo
|
|
extra = 1
|
|
fields = ['fullname', 'email', 'phone_number', 'gender', 'birthdate']
|
|
# readonly_fields = ['email', 'phone_number']
|
|
classes = ['collapse']
|
|
|
|
|
|
|
|
|
|
@admin.register(TransactionParticipant)
|
|
class TransactionParticipantAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'course', 'is_paid', 'price', 'created_at', 'updated_at')
|
|
list_filter = ('is_paid', 'course', 'created_at')
|
|
search_fields = ('user__email', 'course__title')
|
|
readonly_fields = ['user', 'course', 'price', 'created_at', 'updated_at']
|
|
inlines = [ParticipantInfoInline]
|
|
ordering = ('-created_at',)
|
|
list_filter = ('is_paid', 'course', 'created_at')
|
|
|
|
fieldsets = (
|
|
(None, {
|
|
'fields': ('user', 'course', 'is_paid', 'price')
|
|
}),
|
|
(_('Timestamps'), {
|
|
'fields': ('created_at', 'updated_at'),
|
|
'classes': ('collapse',)
|
|
}),
|
|
)
|
|
|