def add_user(request): for i in range(6800, 11500): u = User.objects.create_user( username=str(i * 2 + 1), first_name=(i * 10), last_name=str(i * 100), email="*****@*****.**", password=str(i) ) u.save() customuser = CustomUser(user=u, rate=0) customuser.save() return HttpResponseRedirect(reverse("questions"))
def add_user(request): for i in range(1502, 2000): u = User.objects.create_user( username=str(i), first_name=(i * 10), last_name=str(i * 100), email="*****@*****.**", password=str(i), ) u.save() customuser = CustomUser(user = u, rate = 0) customuser.save()
def add_user(request): for i in range(1502, 2000): u = User.objects.create_user( username=str(i), first_name=(i * 10), last_name=str(i * 100), email="*****@*****.**", password=str(i), ) u.save() customuser = CustomUser(user=u, rate=0) customuser.save()
def reg(request): reg_form = RegForm(request.POST) if reg_form.is_valid(): user = User.objects.create_user( username=reg_form.cleaned_data["username"], first_name=reg_form.cleaned_data["first_name"], last_name=reg_form.cleaned_data["last_name"], email=reg_form.cleaned_data["email"], password=reg_form.cleaned_data["password1"], ) user.save() customuser = CustomUser(user=user, rate=0) customuser.save() request.session["message"] = "Congratulations!! You have successfully registered!!" request.session["flag"] = 1 else: request.session["message"] = "Registration error!!" request.session["flag"] = 0 return HttpResponseRedirect(reverse("questions"))
def SaveUser(self,request): if self.is_valid(): username_data = self.cleaned_data.get('username') email_data = self.cleaned_data.get('email') password_data = self.cleaned_data.get('password') repeat_data = self.cleaned_data.get('repeat') #found = User.objects.get(email=email_data) #if found: if password_data == repeat_data: user = User.objects.create_user(username_data,email_data,password_data) c = CustomUser(user=user) user.save() c.save() return True else: return False #else: # return False else: return False