class SimpleRegistrationForm(forms.Form): next = NextUrlField() username = UserNameField() email = UserEmailField() real_name = UserRealNameField() username_validation = UserNameValidationField() username_validation_sum = UserNameValidationSumField()
def __init__(self, user, *args, **kwargs): super(EditUserForm, self).__init__(*args, **kwargs) if settings.EDITABLE_SCREEN_NAME or (REQUEST_HOLDER.request.user.is_authenticated() and REQUEST_HOLDER.request.user.is_superuser): self.fields['username'] = UserNameField(label=_('Screen name')) self.fields['username'].initial = user.username self.fields['username'].user_instance = user self.fields['email'].initial = user.email self.fields['realname'].initial = user.real_name self.fields['website'].initial = user.website self.fields['city'].initial = user.location if user.date_of_birth is not None: self.fields['birthday'].initial = user.date_of_birth self.fields['about'].initial = user.about self.user = user
def __init__(self, user, *args, **kwargs): super(EditUserForm, self).__init__(*args, **kwargs) if settings.EDITABLE_SCREEN_NAME: self.fields['username'] = UserNameField(label=_('Screen name')) self.fields['username'].initial = user.username self.fields['username'].user_instance = user self.fields['email'].initial = user.email self.fields['realname'].initial = user.real_name self.fields['website'].initial = user.website self.fields['city'].initial = user.location if user.date_of_birth is not None: self.fields['birthday'].initial = user.date_of_birth else: self.fields['birthday'].initial = '1990-01-01' self.fields['about'].initial = user.about self.user = user
def __init__(self, data=None, user=None, custom_badge=None, *args, **kwargs): super(AwardBadgeForm, self).__init__(data, *args, **kwargs) self.fields['user'] = UserNameField(user, custom_badge) if int(user.reputation) < settings.CAPTCHA_IF_REP_LESS_THAN and not ( user.is_superuser or user.is_staff): spam_fields = call_all_handlers('create_anti_spam_field') if spam_fields: spam_fields = dict(spam_fields) for name, field in spam_fields.items(): self.fields[name] = field self._anti_spam_fields = spam_fields.keys() else: self._anti_spam_fields = []
def __init__(self, data=None, *args, **kwargs): super(BadgeFilterForm, self).__init__(data, *args, **kwargs) self.fields['user_filter'] = UserNameField(required=False)
class SimpleRegistrationForm(forms.Form): next = NextUrlField() username = UserNameField() email = UserEmailField() real_name = UserRealNameField()