8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Merge branch 'Fix_Errors_In_Api' into 'dev'

Fix errors in api

See merge request federez/re2o!332
This commit is contained in:
chirac 2018-10-14 22:23:39 +02:00
commit ab06d4354e
2 changed files with 18 additions and 2 deletions

View file

@ -78,13 +78,19 @@ class FactureSerializer(NamespacedHMSerializer):
'control', 'prix_total', 'name', 'api_url')
class BaseInvoiceSerializer(NamespacedHMSerializer):
class Meta:
model = cotisations.BaseInvoice
fields = ('__all__')
class VenteSerializer(NamespacedHMSerializer):
"""Serialize `cotisations.models.Vente` objects.
"""
class Meta:
model = cotisations.Vente
fields = ('facture', 'number', 'name', 'prix', 'duration',
fields = ('facture',
'number', 'name', 'prix', 'duration',
'type_cotisation', 'prix_total', 'api_url')
@ -356,11 +362,15 @@ class OptionalUserSerializer(NamespacedHMSerializer):
"""Serialize `preferences.models.OptionalUser` objects.
"""
tel_mandatory = serializers.BooleanField(source='is_tel_mandatory')
shell_default = serializers.StringRelatedField()
class Meta:
model = preferences.OptionalUser
fields = ('tel_mandatory', 'gpg_fingerprint',
'all_can_create_club', 'self_adhesion', 'shell_default')
'all_can_create_club', 'self_adhesion', 'shell_default',
'self_change_shell', 'local_email_accounts_enabled', 'local_email_domain',
'max_email_address',
)
class OptionalMachineSerializer(NamespacedHMSerializer):

View file

@ -55,6 +55,12 @@ class FactureViewSet(viewsets.ReadOnlyModelViewSet):
queryset = cotisations.Facture.objects.all()
serializer_class = serializers.FactureSerializer
class FactureViewSet(viewsets.ReadOnlyModelViewSet):
"""Exposes list and details of `cotisations.models.Facture` objects.
"""
queryset = cotisations.BaseInvoice.objects.all()
serializer_class = serializers.BaseInvoiceSerializer
class VenteViewSet(viewsets.ReadOnlyModelViewSet):
"""Exposes list and details of `cotisations.models.Vente` objects.