1# Copyright (c) 2012-2016 Seafile Ltd. 2from django import forms 3from django.utils.translation import ugettext_lazy as _ 4 5class RepoShareForm(forms.Form): 6 """ 7 Form for sharing repo to user or group. 8 """ 9 10 email_or_group = forms.CharField(max_length=512) 11 repo_id = forms.CharField(max_length=36) 12 permission = forms.ChoiceField(choices=(('rw', 'read-write'), ('r', 'read-only'))) 13 14class FileLinkShareForm(forms.Form): 15 """ 16 Form for sharing file shared link to emails. 17 """ 18 19 email = forms.CharField(max_length=512, error_messages={ 20 'required': _("Email is required"), 21 'max_length': _("Email is not longer than 512 characters"), 22 }) 23 file_shared_link = forms.CharField() 24 extra_msg = forms.CharField(required=False) 25 file_shared_name = forms.CharField() 26 file_shared_type = forms.CharField() 27 28class UploadLinkShareForm(forms.Form): 29 """ 30 Form for sharing upload link to emails. 31 """ 32 email = forms.CharField(max_length=512, error_messages={ 33 'required': _("Email is required"), 34 'max_length': _("Email is not longer than 512 characters"), 35 }) 36 shared_upload_link = forms.CharField() 37 extra_msg = forms.CharField(required=False) 38