Commit | Line | Data |
---|---|---|
afc8b9b1 PP |
1 | # -*- coding: utf-8 -*- |
2 | ||
3 | from django.contrib import admin | |
4 | ||
5 | from chercheurs.admin import ChercheurAdmin | |
f7eeb1cb | 6 | from rappels.models import ChercheurRappel, RappelModele |
3015f97a | 7 | from rappels import actions |
afc8b9b1 PP |
8 | |
9 | ||
10 | class ChercheurRappelAdmin(ChercheurAdmin): | |
11 | list_display = ['__unicode__', 'last_login'] | |
afc8b9b1 | 12 | list_editable = [] |
3015f97a PP |
13 | |
14 | actions = [actions.rappel] | |
15 | ||
afc8b9b1 PP |
16 | fields = ['salutation', 'nom', 'prenom', 'courriel', 'afficher_courriel', |
17 | 'fonction', 'date_naissance', 'sousfonction', 'telephone', | |
18 | 'adresse_postale', 'genre', 'commentaire', | |
19 | 'nationalite', 'statut', 'diplome', 'etablissement', | |
20 | 'etablissement_autre_nom', 'etablissement_autre_pays', | |
21 | 'attestation', 'thematique', 'mots_cles', 'discipline', | |
22 | 'theme_recherche', 'equipe_recherche', 'url_site_web', | |
23 | 'url_blog', 'url_reseau_social', | |
24 | 'membre_instance_auf', 'membre_instance_auf_nom', | |
25 | 'membre_instance_auf_fonction', 'membre_instance_auf_dates', | |
26 | 'expert_oif', 'expert_oif_details', 'expert_oif_dates', | |
27 | 'membre_association_francophone', 'membre_association_francophone_details', | |
28 | 'membre_reseau_institutionnel', 'membre_reseau_institutionnel_nom', | |
29 | 'membre_reseau_institutionnel_fonction', 'membre_reseau_institutionnel_dates', | |
30 | 'expertises_auf'] | |
31 | ||
32 | def __init__(self, model, admin_site): | |
33 | super(ChercheurRappelAdmin, self).__init__(model, admin_site) | |
34 | self.readonly_fields = self.fields | |
35 | ||
36 | def queryset(self, request): | |
37 | return ChercheurRappel.objects | |
38 | ||
3015f97a PP |
39 | def has_delete_permission(self, request, obj=None): |
40 | return False | |
41 | ||
42 | def get_actions(self, request): | |
43 | actions = super(ChercheurRappelAdmin, self).get_actions(request) | |
44 | ||
45 | del actions['delete_selected'] | |
46 | del actions['export_as_ods'] | |
47 | del actions['export_as_csv'] | |
48 | if 'remove_from_group' in actions: | |
49 | del actions['remove_from_group'] | |
50 | ||
51 | return actions | |
52 | ||
f7eeb1cb | 53 | admin.site.register(ChercheurRappel, ChercheurRappelAdmin) |
3015f97a | 54 | |
afc8b9b1 | 55 | |
f7eeb1cb PP |
56 | class RappelModeleAdmin(admin.ModelAdmin): |
57 | pass | |
58 | admin.site.register(RappelModele, RappelModeleAdmin) |