Exemple #1
0
class ProjectExtraForm(ProjectForm):
    """Additional project information form."""
    class Meta:
        model = Project
        fields = (
            'description',
            'documentation_type',
            'language',
            'programming_language',
            'tags',
            'project_url',
        )

    description = forms.CharField(
        validators=[ClassifierValidator(raises=ProjectSpamError)],
        required=False,
        max_length=150,
        widget=forms.Textarea,
    )

    def clean_tags(self):
        tags = self.cleaned_data.get('tags', [])
        for tag in tags:
            if len(tag) > 100:
                raise forms.ValidationError(
                    _(
                        'Length of each tag must be less than or equal to 100 characters.',
                    ), )
        return tags
Exemple #2
0
class ProjectExtraForm(ProjectForm):
    """Additional project information form"""
    class Meta:
        model = Project
        fields = (
            'description',
            'documentation_type',
            'language',
            'programming_language',
            'project_url',
            'tags',
        )

    description = forms.CharField(
        validators=[ClassifierValidator(raises=ProjectSpamError)],
        widget=forms.Textarea)