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 » Feature Discussions » Username instead of first and second name

Page: Previous 1 2 3 4 Next

one small problem/misunderstanding i didn't catch earlier.. wouldn't it be better to have a setting (community_displayname_filled_with_username_or_fullname) to affect only the fallback, instead of the initial value of the profile form ?

(if the user wants the default behavior there is no need to store the username or first/last name as display name) - what do you think about moving this check right into the get_fullusername() method ?
You mean something like:

def get_fullusername(value):
    """ returns the full username of the given user - if defined
    (No HTML, just text) """
    if not value: return _(u"Anonymous")
   
    profile = value.communityuserprofile_set.all()
    if profile and profile0.displayname:
        return profile0.displayname

    if (not value.first_name or not value.last_name) or\
        get_sph_setting( 'community_displayname_filled_with_username' ) == True:
        return value.username

    return "%s %s" % (value.first_name, value.last_name)


The setting 'community_displayname_filled_with_username' == True would cause the username to take precedence over the fullname (if there is no displayname).

It is ok for me. But there is one more thing: _display_username.html template...
well .. kind of :)
i meant using a setting just for changing what is displayed (get_username, _display_username.html).. and never set an initial value for the 'display name'..

i think if the user clicks 'edit display' and hits 'save' without actually modifying anything .. nothing should change.. and currently it would save back the username (or whatever is configured) back into the profile which could change the output of the user's name ..

do you see my problem ?
Hey, we have Signatures !!! Great, isn't it ? ;)
well .. kind of :)
i meant using a setting just for changing what is displayed (get_username, _display_username.html).. and never set an initial value for the 'display name'..

i think if the user clicks 'edit display' and hits 'save' without actually modifying anything .. nothing should change.. and currently it would save back the username (or whatever is configured) back into the profile which could change the output of the user's name ..

do you see my problem ?
Yes. I didn't write it above but I assumed that the initial value will be removed. The code snippet is an answer to you proposition - "changing what is displayed" instad of using initial formfield's value.

The problem is how to change the template. IMHO there should be a tag which will return the output from get_fullusername (in this situation get_fullusername should be called in a different way.. get_sph_username or something).

So to summarize, I'm going to:
1. remove the initial value
2. change get_fullusername in a way I showed above
3. change the name of sph_setting (you can see it changed in the code above)
4. create a tag to return username and call it from _display_username template
5. ? change get_fullusername function name to get_sph_username

What do you think?
1. remove the initial value
2. change get_fullusername in a way I showed above
3. change the name of sph_setting (you can see it changed in the code above)
4. create a tag to return username and call it from _display_username template
5. ? change get_fullusername function name to get_sph_username
i guess get_fullusername is generally a weird name .. i didn't come up with a better one though :( (since.. it's not actually the 'username' the method returns..)

maybe get_sph_displayname ?

but yes.. it would make sense to put it into a template tag, so the code is only in one place... and we could make it consistent so _display_username.html does no longer display a '(username)' after the 'firstname lastname' ... i guess it is of no use any longer..

ad 2.) how about a more generic name for the setting.. like: community_displayname_default - beeing currently either 'fullname' (default) or 'username' --- or 'fallback' instead of 'default' or something similar .. it's not really that important :)

Hey, we have Signatures !!! Great, isn't it ? ;)
i guess get_fullusername is generally a weird name .. i didn't come up with a better one though :( (since.. it's not actually the 'username' the method returns..)

maybe get_sph_displayname ?
I used 'get_sph_displayname' but at the moment I'm not sure if it was the best choice, because it is a displayname of what? Maybe something like get_userdisplayname would be better.

but yes.. it would make sense to put it into a template tag, so the code is only in one place... and we could make it consistent so _display_username.html does no longer display a '(username)' after the 'firstname lastname' ... i guess it is of no use any longer..

I made some changes in this area. I didn't remove _display_username.html (probally it should be renamed?). For details see the attached patch.

ad 2.) how about a more generic name for the setting.. like: community_displayname_default - beeing currently either 'fullname' (default) or 'username' --- or 'fallback' instead of 'default' or something similar .. it's not really that important :)

I used community_displayname_fallback (the same problem as above - displayname of what?).

One more thing. I've changed names of some methods in the community package. It influences the board and other apps. I searched through the files in all the apps but as I don't use anything but board I can't verify whether wiki or blog is not broken after that.

--- Ostatnio edytowane 2008-04-11 08:00:47 przez Jakub Wiśniowski ---
Attachments
I used 'get_sph_displayname' but at the moment I'm not sure if it was the best choice, because it is a displayname of what? Maybe something like get_userdisplayname would be better.
well .. i guess you are right .. how about get_user_displayname ?

I made some changes in this area. I didn't remove _display_username.html (probally it should be renamed?). For details see the attached patch.


keep the filename .. it is never referenced directly, just through the inclusion tag (afaik) .. so it's name shouldn't be a problem imo.

I used community_displayname_fallback (the same problem as above - displayname of what?).


ok .. so . community_user_displayname_fallback ? :)
(i hate naming .. i'm sure it can't be done right in the end anyway :) )

One more thing. I've changed names of some methods in the community package. It influences the board and other apps. I searched through the files in all the apps but as I don't use anything but board I can't verify whether wiki or blog is not broken after that.


i would prefer to keep the old names .. something like:

def get_user_displayname( .. ):
    ...
    return ...

get_fullusername = get_user_displayname


(i love python for this syntax :) )


this way we can be (quite) sure that nothing is broken afterwards :)

Hey, we have Signatures !!! Great, isn't it ? ;)
well .. i guess you are right .. how about get_user_displayname ?
Done

I made some changes in this area. I didn't remove _display_username.html (probally it should be renamed?). For details see the attached patch.
keep the filename .. it is never referenced directly, just through the inclusion tag (afaik) .. so it's name shouldn't be a problem imo.

Done

ok .. so . community_user_displayname_fallback ? :)
(i hate naming .. i'm sure it can't be done right in the end anyway :) )

Done

i would prefer to keep the old names .. something like:

def get_user_displayname( .. ):
    ...
    return ...

get_fullusername = get_user_displayname


Done

(i love python for this syntax :) )


this way we can be (quite) sure that nothing is broken afterwards :)

I hope so :)


The patch is attached. Let me know if I can commit it.
The patch is attached. Let me know if I can commit it.
looks good to me :)
Hey, we have Signatures !!! Great, isn't it ? ;)
The patch is attached. Let me know if I can commit it.
looks good to me :)
Ok. It is now commited.
Ok. It is now commited.
great, seems to work perfectly .. this installation is now updated too :)

thanks :)
Hey, we have Signatures !!! Great, isn't it ? ;)

Page: Previous 1 2 3 4 Next

Please login to post a reply.



Powered by Sphene Community Tools