Skip to content

Commit

Permalink
cleaned up the edit profile page
Browse files Browse the repository at this point in the history
  • Loading branch information
rockyburt committed Dec 6, 2011
1 parent bf45d1f commit 95f8c69
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
48 changes: 48 additions & 0 deletions profiles/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
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')
Expand Down Expand Up @@ -333,3 +337,47 @@ def smart_redirect(request):
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)
8 changes: 5 additions & 3 deletions urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down

0 comments on commit 95f8c69

Please sign in to comment.