Пример #1
0
 def __init__(self, *args, **kwargs):
     super(ProjectForm, self).__init__(*args, **kwargs)
     # Disable the source_language widget when updating
     if self.instance and self.instance.id:
         if self.instance.resources.count():
             self.fields["source_language"].required = False
             self.fields["source_language"].widget.attrs["disabled"] = "disabled"
     project_form_init.send(sender=ProjectForm, form=self)
Пример #2
0
    def __init__(self, *args, **kwargs):
        # we need this because the number of private projects validation may
        # depend on the owner's subscription
        self.owner = kwargs.pop('owner', None)

        super(ProjectForm, self).__init__(*args, **kwargs)
        # Disable the source_language widget when updating
        if self.instance and self.instance.id:
            if self.instance.resources.count():
                self.fields['source_language'].required = False
                self.fields['source_language'].widget.attrs['disabled'] = 'disabled'
        project_form_init.send(sender=ProjectForm, form=self)
Пример #3
0
    def __init__(self, *args, **kwargs):
        # we need this because the number of private projects validation may
        # depend on the owner's subscription
        self.owner = kwargs.pop('owner', None)

        super(ProjectForm, self).__init__(*args, **kwargs)
        # Disable the source_language widget when updating
        if self.instance and self.instance.id:
            if self.instance.resources.count():
                self.fields['source_language'].required = False
                self.fields['source_language'].widget.attrs[
                    'disabled'] = 'disabled'
        project_form_init.send(sender=ProjectForm, form=self)
Пример #4
0
 def __init__(self, *args, **kwargs):
     super(ProjectForm, self).__init__(*args, **kwargs)
     project_form_init.send(sender=ProjectForm, form=self)