V1.30 notification
This commit is contained in:
@@ -10,10 +10,7 @@ from django.urls import path
|
||||
|
||||
from ..models.customer import Customer
|
||||
from ..models.customer import Sport
|
||||
from ..mautic import MauticHelper
|
||||
from ..cron import cron
|
||||
from ..push_notification import messaging
|
||||
|
||||
from ..automation.notification import Notification
|
||||
|
||||
class SportFilter(SimpleListFilter, ABC):
|
||||
title = "Sport"
|
||||
@@ -22,7 +19,7 @@ class SportFilter(SimpleListFilter, ABC):
|
||||
def lookups(self, request, model_admin):
|
||||
data = []
|
||||
for s in Sport.objects.filter():
|
||||
data.append([s.sport_id, s.sport_name])
|
||||
data.append([s.sport_id, s.name])
|
||||
return data
|
||||
|
||||
def queryset(self, request, queryset):
|
||||
@@ -33,6 +30,8 @@ class SportFilter(SimpleListFilter, ABC):
|
||||
|
||||
|
||||
class CustomerAdmin(admin.ModelAdmin):
|
||||
notif = Notification()
|
||||
|
||||
change_list_template = "controlling/mautic.html"
|
||||
list_display = ('customer_id', 'name','firstname', 'email', 'date_add', 'get_sport')
|
||||
list_filter = (
|
||||
@@ -41,10 +40,10 @@ class CustomerAdmin(admin.ModelAdmin):
|
||||
)
|
||||
|
||||
def get_sport(self, obj):
|
||||
return obj.sport.sport_name
|
||||
return obj.sport.name
|
||||
|
||||
get_sport.short_description = 'Sport'
|
||||
get_sport.admin_order_field = 'sport__sport_name'
|
||||
get_sport.admin_order_field = 'sport__name'
|
||||
|
||||
|
||||
# If you would like to add a default range filter
|
||||
@@ -75,7 +74,7 @@ class CustomerAdmin(admin.ModelAdmin):
|
||||
return my_urls + urls
|
||||
|
||||
def set_mautic(self, request):
|
||||
messaging.send_to_token()
|
||||
self.notif.run()
|
||||
return HttpResponseRedirect("../")
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from ..models import ExerciseType
|
||||
from aitrainer_backoffice.models.exercise_type import ExerciseType
|
||||
|
||||
|
||||
class FrequentExerciseTypeAdmin(admin.ModelAdmin):
|
||||
@@ -11,5 +11,5 @@ class FrequentExerciseTypeAdmin(admin.ModelAdmin):
|
||||
return qs.filter(active=True)
|
||||
|
||||
|
||||
admin.site.register(ExerciseType, FrequentExerciseTypeAdmin)
|
||||
admin.autodiscover()
|
||||
#admin.site.register(FrequentExerciseTypeAdmin)
|
||||
#admin.autodiscover()
|
||||
|
||||
Reference in New Issue
Block a user