2015-03-26 16:00:44 +00:00
|
|
|
from django import forms
|
2023-11-17 12:25:13 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2015-03-26 16:00:44 +00:00
|
|
|
from rest_framework import serializers
|
|
|
|
|
|
|
|
from .. import settings
|
2015-09-21 10:28:49 +00:00
|
|
|
from ..forms import SaaSPasswordForm
|
|
|
|
from .options import SoftwareService
|
2015-03-26 16:00:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
# TODO monitor quota since out of sync?
|
|
|
|
|
2015-09-21 10:28:49 +00:00
|
|
|
class SeaFileForm(SaaSPasswordForm):
|
2015-03-26 16:00:44 +00:00
|
|
|
email = forms.EmailField(label=_("Email"), widget=forms.TextInput(attrs={'size':'40'}))
|
|
|
|
quota = forms.IntegerField(label=_("Quota"), initial=settings.SAAS_SEAFILE_DEFAULT_QUOTA,
|
|
|
|
help_text=_("Disk quota in MB."))
|
|
|
|
|
|
|
|
|
|
|
|
class SeaFileDataSerializer(serializers.Serializer):
|
|
|
|
email = serializers.EmailField(label=_("Email"))
|
|
|
|
quota = serializers.IntegerField(label=_("Quota"), default=settings.SAAS_SEAFILE_DEFAULT_QUOTA,
|
|
|
|
help_text=_("Disk quota in MB."))
|
|
|
|
|
|
|
|
|
|
|
|
class SeaFileService(SoftwareService):
|
|
|
|
name = 'seafile'
|
|
|
|
verbose_name = "SeaFile"
|
|
|
|
form = SeaFileForm
|
|
|
|
serializer = SeaFileDataSerializer
|
|
|
|
icon = 'orchestra/icons/apps/seafile.png'
|
|
|
|
site_domain = settings.SAAS_SEAFILE_DOMAIN
|
2016-02-11 14:24:09 +00:00
|
|
|
change_readonly_fields = ('email',)
|