Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: jazkarta/founderdating
base: 0d3e9953f2
...
head fork: jazkarta/founderdating
compare: 95f8c69087
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
Showing with 75 additions and 5 deletions.
  1. +66 −1 profiles/views.py
  2. +1 −1  settings.py
  3. +8 −3 urls.py
67 profiles/views.py
View
@@ -1,17 +1,22 @@
+from django import forms
from django.shortcuts import render_to_response, redirect
from django.contrib.auth.decorators import login_required
from django.template import RequestContext
from django.views.decorators.http import require_POST
from profiles.models import (LinkedinProfile, Applicant, EmailTemplate,
Event, FdProfile, Interest, Skillset)
+from userena.utils import get_profile_model
+from userena import views as userena_views
import json
from django.db.models import Q
from django.core.paginator import Paginator
+from userena import forms as userena_forms
import logging
logger = logging.getLogger('fd')
+@login_required
def attend(request):
context_instance = RequestContext(request)
user = context_instance['user']
@@ -82,8 +87,13 @@ def attend(request):
context_instance=context_instance)
+@login_required
@require_POST
def attend_save(request):
+ context_instance = RequestContext(request)
+ user = context_instance['user']
+ fdprofile = FdProfile.objects.get(user_id=user.id)
+
e = Event.objects.filter(pk=request.POST.get("event_id", -1))
if len(e) < 1:
raise Exception("Invalid Event")
@@ -115,7 +125,8 @@ def attend_save(request):
idea_status=request.POST.get("idea_status"),
need_skillsets_json=json.dumps(
request.POST.getlist("need_skillsets")),
- recommend_json=json.dumps(recommend)
+ recommend_json=json.dumps(recommend),
+ fdprofile_id=fdprofile.id,
)
applicant.save()
@@ -316,3 +327,57 @@ def members(request):
}
return render_to_response('members.html', c,
context_instance=RequestContext(request))
+
+
+def smart_redirect(request):
+ referer = request.META.get('HTTP_REFERER', '')
+ if referer and '?' in referer:
+ s = referer.split('?')[-1]
+ if '=' in s:
+ last = s.split('=')[1]
+ return redirect(last)
+ return redirect('/')
+
+
+class EditProfileForm(userena_forms.EditProfileForm):
+ first_name = forms.CharField(label=u'First name',
+ max_length=30,
+ required=False)
+ last_name = forms.CharField(label='Last name',
+ max_length=30,
+ required=False)
+ bring_skillsets_json = forms.CharField(label=u'Brings Skillsets',
+ widget=forms.Textarea)
+ need_skillsets_json = forms.CharField(label=u'Needs Skillsets',
+ widget=forms.Textarea)
+ interests_skillsets_json = forms.CharField(label=u'Interests Skillsets',
+ widget=forms.Textarea)
+ past_experience_blurb = forms.CharField(label=u'Past Experience',
+ widget=forms.Textarea)
+ bring_blurb = forms.CharField(label=u'Bring to a Founding Team',
+ widget=forms.Textarea)
+ building_blurb = forms.CharField(label=u'Currently Building',
+ widget=forms.Textarea)
+
+ def __init__(self, *args, **kw):
+ super(userena_forms.EditProfileForm, self).__init__(*args, **kw)
+ new_order = self.fields.keyOrder[:-2]
+ for field in ('last_name', 'first_name'):
+ try:
+ index = new_order.index(field)
+ del new_order[index]
+ except ValueError:
+ pass
+ new_order.insert(0, 'first_name')
+ new_order.insert(1, 'last_name')
+ self.fields.keyOrder = new_order
+
+ class Meta:
+ model = get_profile_model()
+ exclude = userena_forms.EditProfileForm.Meta.exclude + \
+ ['event_status']
+
+
+def profile_edit(request, *args, **kwargs):
+ return userena_views.profile_edit(request, edit_profile_form=EditProfileForm,
+ *args, **kwargs)
2  settings.py
View
@@ -187,7 +187,7 @@
'django.contrib.auth.backends.ModelBackend',
)
AUTH_PROFILE_MODULE = "profiles.FdProfile"
-LOGIN_REDIRECT_URL = '/'
+LOGIN_REDIRECT_URL = '/smart_redirect'
LOGIN_URL = '/profiles/signin/'
LOGOUT_URL = '/profiles/signout/'
11 urls.py
View
@@ -16,13 +16,15 @@
(r'^(robots.txt)', 'django.views.static.serve',
{'document_root' : path.join(settings.ROOT_PATH, 'profiles', 'static')}),
+ (r'^accounts/(?P<username>[@\.\w]+)/edit/$',
+ 'fd.profiles.views.profile_edit'),
+ (r'^profiles/(?P<username>(?!signout|signup|signin)[@\.\w]+)/$',
+ 'userena.views.profile_detail'),
+
# basic account creation
(r'^profiles/', include('userena.urls')),
(r'^accounts/', include('userena.urls')),
- (r'^profiles/(?P<username>(?!signout|signup|signin)[@\.\w]+)/$',
- 'userena.views.profile_detail'),
-
# Application process
(r'^attend/save', 'profiles.views.attend_save'),
(r'^attend/thanks', 'profiles.views.attend_thanks'),
@@ -53,6 +55,9 @@
url(r'^comments/', include('django.contrib.comments.urls')),
# django cms
+ url(r'^smart_redirect$', 'profiles.views.smart_redirect'),
+
+ # django cms
url(r'^', include('cms.urls')),
)

No commit comments for this range

Something went wrong with that request. Please try again.