On Sun, Apr 27, 2014 at 5:24 AM, <mato...@gmail.com> wrote:

> I have a problem with settings for mezzanine accounts. I would like to
> have profiles, where user is using mail instead of username. And also I
> would like to have "Full name" and "What we should call you?" instead of
> "First name" and "Second name" according to W3C suggestions. The issue is,
> if I do those things together:
>
> ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS = (
>      "first_name",
>      "last_name",
> )
>
> ACCOUNTS_NO_USERNAME = True
>
> - it doesn't work. Returned error is:
>
> KeyError at /account/signup/
> u'first_name'
>
> It is in code:
>
>         try:
>             self.cleaned_data["username"]
>         except KeyError:
>             if not self.instance.username:
>                 username = "%(first_name)s %(last_name)s" %
> self.cleaned_data
>                 if not username.strip():
>                     username = self.cleaned_data["email"].split("@")[0]
>                 qs = User.objects.exclude(id=self.instance.id)
>                 user.username = unique_slug(qs, "username",
> slugify(username))
>         password = self.cleaned_data.get("password1")
>
> The exact issue is line:
> username = "%(first_name)s %(last_name)s" % self.cleaned_data
>
> I think there should be another "try" to catch if first name doesnt exist
> and in that case use email or random string.
>
> Is the problem really that simple? Or I get it wrong and my issue need
> different repair?
>

Yes I think you're right here and simply another check to handle no
firstname/lastname combo will suffice - you'll see the next few lines
already deal with not being able to extract a username from those two
fields, in fact I think the intention there was to deal with this very case
where those fields are omitted from the profile setup.

Please go ahead and submit the fix if you'd like to.


>
> If the problem is really in that, I would like to contribute to mezzanine
> and repair that. Maybe also should be good to have in mezzanine same option
> for "fullname"+"What should we call you" insted of "first+second name".
>
> What do you think?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to