merged
This commit is contained in:
commit
9695094638
|
@ -58,6 +58,7 @@ def signup(request, **kwargs):
|
|||
template_name = kwargs.pop("template_name", "account/signup.html")
|
||||
redirect_field_name = kwargs.pop("redirect_field_name", "next")
|
||||
success_url = kwargs.pop("success_url", None)
|
||||
invite_code = kwargs.pop("invite_code", None)
|
||||
|
||||
if success_url is None:
|
||||
success_url = get_default_redirect(request, redirect_field_name)
|
||||
|
@ -66,6 +67,11 @@ def signup(request, **kwargs):
|
|||
form = form_class(request.POST)
|
||||
if form.is_valid():
|
||||
user = form.save(request=request)
|
||||
if invite_code:
|
||||
from itfprofiles.models import PersonInvitation, Person
|
||||
person = PersonInvite.objects.get(invite_code=invite_code).invitee
|
||||
person.user = user
|
||||
#success_url = '/edit_profile'
|
||||
return complete_signup(request, user, success_url)
|
||||
|
||||
else:
|
||||
|
|
|
@ -253,7 +253,7 @@ class ItfAllAuthRegForm(forms.Form):
|
|||
def save(self, user, request=None):
|
||||
first_name = self.cleaned_data['firstname']
|
||||
last_name = self.cleaned_data['lastname']
|
||||
if request.session['invite_code']:
|
||||
if request.session.has_key('invite_code'):
|
||||
invite_code = request.session['invite_code']
|
||||
pi = PersonInvitation.objects.get(invite_code=invite_code)
|
||||
inviter = pi.inviter
|
||||
|
|
|
@ -27,8 +27,8 @@ class Person(ItfModel):
|
|||
#ItfModel stuff:
|
||||
form_names = ['PersonForm', 'PopupPersonForm']
|
||||
fts_fields = ['first_name', 'last_name', 'email', 'about']
|
||||
#Basic Info
|
||||
user = models.ForeignKey(User, blank=True, null=True, db_index=True, editable=False)
|
||||
#Basic Info
|
||||
user = models.OneToOneField(User, blank=True, null=True, db_index=True, editable=False)
|
||||
first_name = models.CharField(max_length=255)
|
||||
last_name = models.CharField(max_length=255)
|
||||
email = models.EmailField(blank=True, null=True, unique=True, db_index=True)
|
||||
|
|
|
@ -84,8 +84,11 @@ def friend_invite(request):
|
|||
|
||||
|
||||
def invitation_accept(request,invite_code):
|
||||
#invitation = get_object_or_404(PersonInvitation, invite_code__exact=invite_code)
|
||||
invitee = get_object_or_404(PersonInvitation, invite_code__exact=invite_code).invitee
|
||||
request.session['invite_code'] = invite_code
|
||||
request.session['invitee_first_name'] = invitee.first_name
|
||||
request.session['invtee_last_name'] = invitee.last_name
|
||||
request.session['invitee_email'] = invitee.email
|
||||
return HttpResponseRedirect('/accounts/signup')
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,19 @@
|
|||
|
||||
<form class="signup" id="signup_form" method="post" action="{% url account_signup %}">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
{{ form.as_p }}
|
||||
|
||||
<script>
|
||||
var fn= "{{ request.session.invitee_first_name }}"
|
||||
var ln= "{{ request.session.invitee_last_name }}"
|
||||
var email= "{{ request.session.invitee_email }}"
|
||||
|
||||
</script>
|
||||
|
||||
{% if request.session.invite_code %}
|
||||
<input type="hidden" name="icode" value="{{ request.session.invite_code }}" />
|
||||
{% endif %}
|
||||
|
||||
{% if redirect_field_value %}
|
||||
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user