~ubuntuone-pqm-team/django-openid-auth/trunk

« back to all changes in this revision

Viewing changes to django_openid_auth/forms.py

  • Committer: Ricardo Kirkner
  • Date: 2017-03-31 17:25:44 UTC
  • mto: This revision was merged to the branch mainline in revision 128.
  • Revision ID: ricardo.kirkner@canonical.com-20170331172544-iwtx4l1jisbhiw5v
support python 2.7 and 3.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
from openid.yadis import xri
40
40
 
 
41
from django_openid_auth import PY3
 
42
 
41
43
 
42
44
def teams_new_unicode(self):
43
45
    """
52
54
    else:
53
55
        return name
54
56
 
55
 
Group.unicode_before_teams = Group.__unicode__
56
 
Group.__unicode__ = teams_new_unicode
 
57
 
 
58
if PY3:
 
59
    Group.unicode_before_teams = Group.__str__
 
60
    Group.__str__ = teams_new_unicode
 
61
else:
 
62
    Group.unicode_before_teams = Group.__unicode__
 
63
    Group.__unicode__ = teams_new_unicode
57
64
 
58
65
 
59
66
class UserChangeFormWithTeamRestriction(UserChangeForm):
72
79
                    "You cannot assign it manually." % group.name)
73
80
        return data
74
81
 
 
82
 
75
83
UserAdmin.form = UserChangeFormWithTeamRestriction
76
84
 
77
85