mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-26 22:52:26 +00:00
API support for app preferences
This commit is contained in:
parent
e2736e17df
commit
2ef8930ffe
3 changed files with 186 additions and 11 deletions
|
@ -53,6 +53,17 @@ from machines.models import (
|
|||
OuverturePortList,
|
||||
OuverturePort
|
||||
)
|
||||
from preferences.models import (
|
||||
OptionalUser,
|
||||
OptionalMachine,
|
||||
OptionalTopologie,
|
||||
GeneralOption,
|
||||
AssoOption,
|
||||
HomeOption,
|
||||
MailMessageOption
|
||||
)
|
||||
# Avoid duplicate names
|
||||
from preferences.models import Service as ServiceOption
|
||||
from users.models import (
|
||||
User,
|
||||
Club,
|
||||
|
@ -352,6 +363,99 @@ class OuverturePortSerializer(serializers.HyperlinkedModelSerializer):
|
|||
}
|
||||
|
||||
|
||||
# PREFERENCES APP
|
||||
|
||||
|
||||
# class OptionalUserSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# tel_mandatory = serializers.BooleanField(source='is_tel_mandatory')
|
||||
#
|
||||
# class Meta:
|
||||
# model = OptionalUser
|
||||
# fields = ('tel_mandatory', 'user_solde', 'solde_negatif', 'max_solde',
|
||||
# 'min_online_payement', 'gpg_fingerprint',
|
||||
# 'all_can_create_club', 'self_adhesion', 'shell_default',
|
||||
# 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'shell_default': {'view_name': 'api:shell-detail'},
|
||||
# 'api_url': {'view_name': 'api:optionaluser-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class OptionalMachineSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = OptionalMachine
|
||||
# fields = ('password_machine', 'max_lambdauser_interfaces',
|
||||
# 'max_lambdauser_aliases', 'ipv6_mode', 'create_machine',
|
||||
# 'ipv6', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'api_url': {'view_name': 'api:optionalmachine-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class OptionalTopologieSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = OptionalTopologie
|
||||
# fields = ('radius_general_policy', 'vlan_decision_ok',
|
||||
# 'vlan_decision_no', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'vlan_decision_ok': {'view_name': 'api:vlan-detail'},
|
||||
# 'vlan_decision_nok': {'view_name': 'api:vlan-detail'},
|
||||
# 'api_url': {'view_name': 'api:optionaltopologie-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class GeneralOptionSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = GeneralOption
|
||||
# fields = ('general_message', 'search_display_page',
|
||||
# 'pagination_number', 'pagination_large_number',
|
||||
# 'req_expire_hrs', 'site_name', 'email_from', 'GTU_sum_up',
|
||||
# 'GTU', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'api_url': {'view_name': 'api:generaloption-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class ServiceOptionSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = ServiceOption
|
||||
# fields = ('name', 'url', 'description', 'image', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'api_url': {'view_name': 'api:serviceoption-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class AssoOptionSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = AssoOption
|
||||
# fields = ('name', 'siret', 'adresse1', 'adresse2', 'contact',
|
||||
# 'telephone', 'pseudo', 'utilisateur_asso', 'payement',
|
||||
# 'payement_id', 'payement_pass', 'description', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'utilisateur_asso': {'view_name': 'api:user-detail'},
|
||||
# 'api_url': {'view_name': 'api:assooption-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class HomeOptionSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = HomeOption
|
||||
# fields = ('facebook_url', 'twitter_url', 'twitter_account_name',
|
||||
# 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'api_url': {'view_name': 'api:homeoption-detail'}
|
||||
# }
|
||||
#
|
||||
#
|
||||
# class MailMessageOptionSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = MailMessageOption
|
||||
# fields = ('welcome_mail_fr', 'welcome_mail_en', 'api_url')
|
||||
# extra_kwargs = {
|
||||
# 'api_url': {'view_name': 'api:mailmessageoption-detail'}
|
||||
# }
|
||||
|
||||
|
||||
# USERS APP
|
||||
|
||||
|
||||
|
|
|
@ -57,6 +57,15 @@ router.register(r'services', views.ServiceViewSet)
|
|||
router.register(r'servicelinks', views.ServiceLinkViewSet, 'servicelink')
|
||||
router.register(r'ouvertureportlists', views.OuverturePortListViewSet)
|
||||
router.register(r'ouvertureports', views.OuverturePortViewSet)
|
||||
# PREFERENCES APP
|
||||
#router.register(r'optionaluser', views.OptionalUserSerializer)
|
||||
#router.register(r'optionalmachine', views.OptionalMachineSerializer)
|
||||
#router.register(r'optionaltopologie', views.OptionalTopologieSerializer)
|
||||
#router.register(r'generaloption', views.GeneralOptionSerializer)
|
||||
#router.register(r'serviceoption', views.ServiceOptionSerializer)
|
||||
#router.register(r'assooption', views.AssoOptionSerializer)
|
||||
#router.register(r'homeoption', views.HomeOptionSerializer)
|
||||
#router.register(r'mailmessageoption', views.MailMessageOptionSerializer)
|
||||
# USERS APP
|
||||
router.register(r'users', views.UserViewSet)
|
||||
router.register(r'clubs', views.ClubViewSet)
|
||||
|
|
84
api/views.py
84
api/views.py
|
@ -42,17 +42,6 @@ from cotisations.models import (
|
|||
Paiement,
|
||||
Cotisation
|
||||
)
|
||||
from users.models import (
|
||||
User,
|
||||
Club,
|
||||
Adherent,
|
||||
ServiceUser,
|
||||
School,
|
||||
ListRight,
|
||||
ListShell,
|
||||
Ban,
|
||||
Whitelist
|
||||
)
|
||||
from machines.models import (
|
||||
Machine,
|
||||
MachineType,
|
||||
|
@ -74,6 +63,28 @@ from machines.models import (
|
|||
OuverturePortList,
|
||||
OuverturePort
|
||||
)
|
||||
# from preferences.models import (
|
||||
# OptionalUser,
|
||||
# OptionalMachine,
|
||||
# OptionalTopologie,
|
||||
# GeneralOption,
|
||||
# AssoOption,
|
||||
# HomeOption,
|
||||
# MailMessageOption
|
||||
# )
|
||||
# # Avoid duplicate names
|
||||
# from preferences.models import Service as ServiceOption
|
||||
from users.models import (
|
||||
User,
|
||||
Club,
|
||||
Adherent,
|
||||
ServiceUser,
|
||||
School,
|
||||
ListRight,
|
||||
ListShell,
|
||||
Ban,
|
||||
Whitelist
|
||||
)
|
||||
|
||||
from .serializers import (
|
||||
# COTISATIONS APP
|
||||
|
@ -103,6 +114,15 @@ from .serializers import (
|
|||
ServiceLinkSerializer,
|
||||
OuverturePortListSerializer,
|
||||
OuverturePortSerializer,
|
||||
# PREFERENCES APP
|
||||
# OptionalUserSerializer,
|
||||
# OptionalMachineSerializer,
|
||||
# OptionalTopologieSerializer,
|
||||
# GeneralOptionSerializer,
|
||||
# ServiceOptionSerializer,
|
||||
# AssoOptionSerializer,
|
||||
# HomeOptionSerializer,
|
||||
# MailMessageOptionSerializer,
|
||||
# USERS APP
|
||||
UserSerializer,
|
||||
ClubSerializer,
|
||||
|
@ -247,6 +267,48 @@ class OuverturePortViewSet(viewsets.ReadOnlyModelViewSet):
|
|||
serializer_class = OuverturePortSerializer
|
||||
|
||||
|
||||
# PREFERENCES APP
|
||||
|
||||
# class OptionalUserViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = OptionalUser.objects.all()
|
||||
# serializer_class = OptionalUserSerializer
|
||||
#
|
||||
#
|
||||
# class OptionalMachineViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = OptionalMachine.objects.all()
|
||||
# serializer_class = OptionalMachineSerializer
|
||||
#
|
||||
#
|
||||
# class OptionalTopologieViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = OptionalTopologie.objects.all()
|
||||
# serializer_class = OptionalTopologieSerializer
|
||||
#
|
||||
#
|
||||
# class GeneralOptionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = GeneralOption.objects.all()
|
||||
# serializer_class = GeneralOptionSerializer
|
||||
#
|
||||
#
|
||||
# class ServiceOptionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = ServiceOption.objects.all()
|
||||
# serializer_class = ServiceOptionSerializer
|
||||
#
|
||||
#
|
||||
# class AssoOptionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = AssoOption.objects.all()
|
||||
# serializer_class = AssoOptionSerializer
|
||||
#
|
||||
#
|
||||
# class HomeOptionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = HomeOption.objects.all()
|
||||
# serializer_class = HomeOptionSerializer
|
||||
#
|
||||
#
|
||||
# class MailMessageOptionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
# queryset = MailMessageOption.objects.all()
|
||||
# serializer_class = MailMessageOptionSerializer
|
||||
|
||||
|
||||
# USER APP
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue