Sphene Community Tools

Community

Copyright © 2007-2018 by Herbert Poul

You are not logged in.
Login
Register

Change Language:



AddThis Social Bookmark Button

A Django site.

Powered by Sphene Community Tools
Board » General » Removing fields from community EditProfileForm

Hi.
I have Sphene board integrated with Pinax and I would prefer to leave some features to Pinax instead of Sphene, such as password change, managing avatars and so on. So I need to remove most of extra fields from profile form in community app.
But as I understand it, it uses signals and it's a bit complicated to me, so I would be grateful for a little advice.
well..
you could remove it by connecting to the signal community_profile_edit_init_form .. BUT the problem is, that most fields which are there (first name, last name, ..) are hardcoded during the save phase without checks that it exists:

            user.first_name = data['first_name']
            user.last_name = data['last_name']


so if you just remove those fields, it will raise an exception. so the only thing you could try is to replace them with hidden input fields..

the way to do this would be something like (e.g. in your applications __init__.py):

from django import forms

from sphene.community.signals import profile_edit_init_form
from sphene.community.forms import EditProfileForm

def handle_init_form(sender, instance, signal, request, *args, **kwargs):
    instance['first_name'].widget = forms.HiddenInput()
    instance['last_name'].widget = forms.HiddenInput()

profile_edit_init_form.connect(handle_init_form, sender = EditProfileForm)


i haven't tried it, but it should give you a hint on how to get started.. let me know if it works or if you encounter any problems.
Hey, we have Signatures !!! Great, isn't it ? ;)

Please login to post a reply.



Powered by Sphene Community Tools