|
@@ -14,11 +14,10 @@ import coin.members.admin
|
|
|
|
|
|
class AddMaillingListSubscriptionInline(admin.StackedInline):
|
|
class AddMaillingListSubscriptionInline(admin.StackedInline):
|
|
model = MaillingListSubscription
|
|
model = MaillingListSubscription
|
|
- extra = 1
|
|
|
|
- max_num = 1
|
|
|
|
|
|
+ extra = 0
|
|
fields = ('member', 'maillinglist')
|
|
fields = ('member', 'maillinglist')
|
|
- verbose_name_plural = "Ajouter un abonnement à la liste mail"
|
|
|
|
- verbose_name = "Ajouter un abonnement"
|
|
|
|
|
|
+ verbose_name_plural = "Ajouter un abonnement à une liste mail"
|
|
|
|
+ verbose_name = "abonnement"
|
|
|
|
|
|
form = autocomplete_light.modelform_factory(MaillingListSubscription, fields='__all__')
|
|
form = autocomplete_light.modelform_factory(MaillingListSubscription, fields='__all__')
|
|
|
|
|
|
@@ -30,6 +29,11 @@ class AddMaillingListSubscriptionInline(admin.StackedInline):
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
+class AddSubscriberInline(AddMaillingListSubscriptionInline):
|
|
|
|
+ verbose_name_plural = "Ajouter des abonné·e·s"
|
|
|
|
+ verbose_name = "abonné·e"
|
|
|
|
+
|
|
|
|
+
|
|
class MaillingListSubscriptionInline(admin.TabularInline):
|
|
class MaillingListSubscriptionInline(admin.TabularInline):
|
|
model = MaillingListSubscription
|
|
model = MaillingListSubscription
|
|
|
|
|
|
@@ -39,6 +43,11 @@ class MaillingListSubscriptionInline(admin.TabularInline):
|
|
return False
|
|
return False
|
|
|
|
|
|
|
|
|
|
|
|
+class SubscribersInline(MaillingListSubscriptionInline):
|
|
|
|
+ verbose_name_plural = "Abonné·e·s"
|
|
|
|
+ verbose_name = "abonné·e"
|
|
|
|
+
|
|
|
|
+
|
|
class MaillingListAdmin(admin.ModelAdmin):
|
|
class MaillingListAdmin(admin.ModelAdmin):
|
|
list_display = ('email', 'verbose_name')
|
|
list_display = ('email', 'verbose_name')
|
|
actions = ['sync_to_server']
|
|
actions = ['sync_to_server']
|
|
@@ -60,7 +69,7 @@ class MaillingListAdmin(admin.ModelAdmin):
|
|
sync_to_server.short_description = (
|
|
sync_to_server.short_description = (
|
|
'Synchroniser les listes sélectionnées vers le serveur')
|
|
'Synchroniser les listes sélectionnées vers le serveur')
|
|
|
|
|
|
- inlines = [AddMaillingListSubscriptionInline, MaillingListSubscriptionInline,]
|
|
|
|
|
|
+ inlines = [AddSubscriberInline, SubscribersInline]
|
|
|
|
|
|
def change_view(self, request, object_id, *args, **kwargs):
|
|
def change_view(self, request, object_id, *args, **kwargs):
|
|
try:
|
|
try:
|
|
@@ -83,7 +92,10 @@ admin.site.register(MaillingList, MaillingListAdmin)
|
|
|
|
|
|
|
|
|
|
class MemberAdmin(coin.members.admin.MemberAdmin):
|
|
class MemberAdmin(coin.members.admin.MemberAdmin):
|
|
- inlines = coin.members.admin.MemberAdmin.inlines + [AddMaillingListSubscriptionInline, MaillingListSubscriptionInline]
|
|
|
|
|
|
+ inlines = coin.members.admin.MemberAdmin.inlines + [
|
|
|
|
+ MaillingListSubscriptionInline,
|
|
|
|
+ AddMaillingListSubscriptionInline,
|
|
|
|
+ ]
|
|
|
|
|
|
def change_view(self, request, *args, **kwargs):
|
|
def change_view(self, request, *args, **kwargs):
|
|
try:
|
|
try:
|