Source code for geonode.people.forms

#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################

import taggit

from django import forms
from django.contrib.auth import get_user_model
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from django.utils.translation import ugettext as _

from captcha.fields import ReCaptchaField

# Ported in from django-registration
[docs] attrs_dict = {"class": "required"}
[docs] class AllauthReCaptchaSignupForm(forms.Form):
[docs] captcha = ReCaptchaField()
[docs] def signup(self, request, user): """Required, or else it thorws deprecation warnings""" pass
[docs] class ProfileCreationForm(UserCreationForm):
[docs] class Meta:
[docs] model = get_user_model()
[docs] fields = ("username",)
[docs] class ProfileChangeForm(UserChangeForm):
[docs] class Meta:
[docs] model = get_user_model()
[docs] fields = "__all__"
[docs] class ForgotUsernameForm(forms.Form):
[docs] email = forms.EmailField(widget=forms.TextInput(attrs=dict(attrs_dict, maxlength=75)), label=_("Email Address"))
[docs] class ProfileForm(forms.ModelForm):
[docs] keywords = taggit.forms.TagField( label=_("Keywords"), required=False, help_text=_("A space or comma-separated list of keywords") )
[docs] class Meta:
[docs] model = get_user_model()
[docs] exclude = ( "user", "password", "last_login", "groups", "user_permissions", "username", "is_staff", "is_superuser", "is_active", "date_joined", "language", )