# HG changeset patch
# User anoop
# Date 1265023354 -19800
# Node ID 3e676fa948c4ebdd45571a54447f18daa064c356
# Parent c5a282b84eb86aa25269dd88d20bde14ea21012d
changed the view my profile template.
diff -r c5a282b84eb8 -r 3e676fa948c4 pytask/taskapp/forms/user.py
--- a/pytask/taskapp/forms/user.py Mon Feb 01 15:16:40 2010 +0530
+++ b/pytask/taskapp/forms/user.py Mon Feb 01 16:52:34 2010 +0530
@@ -16,27 +16,6 @@
username = forms.CharField(max_length=30, required=True)
password = forms.CharField(max_length=60, required=True, widget=forms.PasswordInput)
-class UserProfileForm(ModelForm):
- class Meta:
- model = Profile
- exclude = ('user','rights')
- def __init__(self, *args, **kwargs):
- super(UserProfileForm, self).__init__(*args, **kwargs)
- instance = getattr(self, 'instance', None)
- if instance and instance.id:
- self.fields['dob'].widget.attrs['readonly'] = True
- self.fields['gender'].widget.attrs['readonly'] = True
- self.fields['credits'].widget.attrs['readonly'] = True
- self.fields['aboutme'].widget.attrs['readonly'] = True
- self.fields['foss_comm'].widget.attrs['readonly'] = True
- self.fields['phonenum'].widget.attrs['readonly'] = True
- self.fields['homepage'].widget.attrs['readonly'] = True
- self.fields['street'].widget.attrs['readonly'] = True
- self.fields['city'].widget.attrs['readonly'] = True
- self.fields['country'].widget.attrs['readonly'] = True
- self.fields['nick'].widget.attrs['readonly'] = True
- #fields = ['dob','gender','credits','aboutme','foss_comm','phonenum','homepage','street','city','country','nick']
-
class UserProfileEditForm(ModelForm):
class Meta:
model = Profile
diff -r c5a282b84eb8 -r 3e676fa948c4 pytask/taskapp/views/user.py
--- a/pytask/taskapp/views/user.py Mon Feb 01 15:16:40 2010 +0530
+++ b/pytask/taskapp/views/user.py Mon Feb 01 16:52:34 2010 +0530
@@ -1,7 +1,7 @@
from django.http import HttpResponse
from django.shortcuts import redirect, render_to_response
from pytask.taskapp.models import Task
-from pytask.taskapp.forms.user import RegistrationForm, LoginForm, UserProfileForm, UserProfileEditForm
+from pytask.taskapp.forms.user import RegistrationForm, LoginForm, UserProfileEditForm
from pytask.taskapp.events.user import createUser, updateProfile
from django.contrib.auth import login, logout, authenticate
from django.contrib.auth.models import User
@@ -104,10 +104,9 @@
edit_profile = True if request.user == User.objects.get(pk=uid) else False
try:
profile = Profile.objects.get(user = User.objects.get(pk=uid))
- view_profile_form = UserProfileForm(instance = profile)
except Profile.DoesNotExist:
raise Http404
- return render_to_response('user/my_profile.html', {'view_profile_form': view_profile_form,'edit_profile':edit_profile})
+ return render_to_response('user/my_profile.html', {'edit_profile':edit_profile,'profile':profile})
def edit_my_profile(request):
""" enables the user to edit his/her user profile """
diff -r c5a282b84eb8 -r 3e676fa948c4 pytask/templates/user/my_profile.html
--- a/pytask/templates/user/my_profile.html Mon Feb 01 15:16:40 2010 +0530
+++ b/pytask/templates/user/my_profile.html Mon Feb 01 16:52:34 2010 +0530
@@ -1,11 +1,50 @@
{% extends 'base.html' %}
+
+{% block title %}
+ {{ profile.user }}'s Profile
+{% endblock %}
+
{% block content %}
+
-{% if edit_profile %}
- edit my profile
-{% endif %}
-
-
-{{ view_profile_form.as_p }}
-
+