3
0
Fork 0
mirror of https://github.com/nanoy42/coope synced 2024-12-24 16:03:47 +00:00
coope/preferences/admin.py

57 lines
2.3 KiB
Python
Raw Normal View History

2018-08-31 12:46:35 +00:00
from django.contrib import admin
2018-11-27 08:07:12 +00:00
from simple_history.admin import SimpleHistoryAdmin
2019-09-12 07:40:43 +00:00
from .models import PaymentMethod, GeneralPreferences, Cotisation, DivideHistory, PriceProfile, Improvement
2018-10-05 22:03:02 +00:00
2019-02-27 07:59:41 +00:00
class CotisationAdmin(SimpleHistoryAdmin):
2019-02-28 12:18:41 +00:00
"""
The admin class for :class:`Consumptions <preferences.models.Cotisation>`.
"""
2019-02-27 07:59:41 +00:00
list_display = ('__str__', 'amount', 'duration')
ordering = ('-duration', '-amount')
class GeneralPreferencesAdmin(SimpleHistoryAdmin):
2019-02-28 12:18:41 +00:00
"""
The admin class for :class:`Consumptions <preferences.models.GeneralPreferences>`.
"""
list_display = ('is_active', 'president', 'treasurer', 'secretary', 'phoenixTM_responsible', 'use_pinte_monitoring', 'lost_pintes_allowed', 'floating_buttons', 'automatic_logout_time')
2019-02-27 07:59:41 +00:00
class PaymentMethodAdmin(SimpleHistoryAdmin):
2019-02-28 12:18:41 +00:00
"""
The admin class for :class:`Consumptions <preferences.models.PaymentMethod>`.
"""
2019-02-27 07:59:41 +00:00
list_display = ('name', 'is_active', 'is_usable_in_cotisation', 'is_usable_in_reload', 'affect_balance')
ordering = ('name',)
search_fields = ('name',)
list_filter = ('is_active', 'is_usable_in_cotisation', 'is_usable_in_reload', 'affect_balance')
2019-06-23 12:53:18 +00:00
class PriceProfileAdmin(SimpleHistoryAdmin):
"""
The admin class for :class:`Consumptions <preferences.models.PriceProfile>`.
"""
list_display = ('name', 'a', 'b', 'c', 'alpha', 'use_for_draft')
ordering = ('name',)
search_fields = ('name',)
list_filter = ('use_for_draft',)
2019-06-23 08:54:21 +00:00
class DivideHistoryAdmin(SimpleHistoryAdmin):
"""
The admin class for Divide histories
"""
list_display = ('date', 'total_cotisations', 'total_cotisations_amount', 'total_ptm_amount', 'coopeman')
ordering = ('-date',)
2019-09-12 07:40:43 +00:00
class ImprovementAdmin(SimpleHistoryAdmin):
"""
The admin class for Improvement.
"""
list_display = ('title', 'mode', 'seen', 'done', 'date')
ordering = ('-date',)
search_fields = ('title', 'description')
list_filter = ('mode', 'seen', 'done')
2019-02-27 07:59:41 +00:00
admin.site.register(PaymentMethod, PaymentMethodAdmin)
admin.site.register(GeneralPreferences, GeneralPreferencesAdmin)
2019-06-23 08:54:21 +00:00
admin.site.register(Cotisation, CotisationAdmin)
2019-06-23 12:53:18 +00:00
admin.site.register(PriceProfile, PriceProfileAdmin)
2019-09-12 07:40:43 +00:00
admin.site.register(DivideHistory, DivideHistoryAdmin)
admin.site.register(Improvement, ImprovementAdmin)