What's wrong taht code if i try register i seeing.
AttributeError at /register/
'str' object has no attribute 'decode'
'uid':urlsafe_base64_encode(force_bytes(user.pk)).decode('utf-8'), whats
problem on this line.
class MyUserCreationForm(UserCreationForm):
class Meta:
# Yeni Model
model = User
# Yeni alanlar
fields = { 'username', 'password1', 'password2', 'email',}
exclude = ['Avatar','gender','birth_date',]
def clean_username(self):
username = self.cleaned_data['username'].lower()
if username in blacklist:
raise ValidationError("Lütfen başka bir kullanıcı adı seçin.")
return username
def save(self, commit=True):
user = super(UserCreationForm, self).save(commit=True)
current_site = Site.objects.get_current()
mail_subject = 'Activate your blog account.'
message = render_to_string('includes/emails/activation-mail.html', {
'user': user,
'domain': current_site.domain,
'uid':urlsafe_base64_encode(force_bytes(user.pk)).decode('utf-8'),
'token':account_activation_token.make_token(user),
})
to_email = form.cleaned_data.get('email')
email = EmailMessage(
mail_subject, message, to=[to_email]
)
email.send()
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/0b4256b7-080a-4f85-b4e3-e741ec8447ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.