def save(self, commit=True): email = self.cleaned_data["email"] if user_exists(email): # A 'User Seed' existing for this email address. user = get_user(email) user.set_password(self.cleaned_data["password1"]) seed_group = Group.objects.get(name=SEED_GROUP) user.groups.remove(seed_group) else: user = super(NewUserForm, self).save(commit=False) user.first_name = self.cleaned_data["first_name"] user.last_name = self.cleaned_data["last_name"] if commit: user.save() if self.cleaned_data["subscribe_announce"]: try: subscribe_to_announce(user.email, first_name=user.first_name, last_name=user.last_name) except: pass return user
def subscribe(request, email): if subscribe_to_announce(email): return jsonResponse({"status": "ok"}) else: return jsonResponse({"error": "Something went wrong."})
def subscribe(request, email): if subscribe_to_announce(email): return jsonResponse({"status": "ok"}) else: return jsonResponse({"error": "Sorry, there was an error."})