From a4b9a1b8045a0b0938ec93da927ee4a346542b04 Mon Sep 17 00:00:00 2001 From: dzhuang <dzhuang.scut@gmail.com> Date: Mon, 1 Feb 2016 12:37:29 +0800 Subject: [PATCH] fix as advised. --- course/admin.py | 3 ++- course/enrollment.py | 2 -- course/grades.py | 3 --- .../templates/course/participation-table.html | 12 +---------- local_settings.py.example | 21 +++++-------------- relate/settings.py | 5 ----- 6 files changed, 8 insertions(+), 38 deletions(-) diff --git a/course/admin.py b/course/admin.py index 5b0cb4ea..2756ffc4 100644 --- a/course/admin.py +++ b/course/admin.py @@ -591,7 +591,8 @@ class FlowRuleExceptionAdmin(admin.ModelAdmin): search_fields = ( "flow_id", "participation__user__username", - "participation__user__full_name", + "participation__user__first_name", + "participation__user__last_name", "comment", ) diff --git a/course/enrollment.py b/course/enrollment.py index 7acab3fb..ec48e12f 100644 --- a/course/enrollment.py +++ b/course/enrollment.py @@ -690,8 +690,6 @@ def query_participations(pctx): return render_course_page(pctx, "course/query-participations.html", { "form": form, "result": result, - "RELATE_DISPLAY_USER_FULLNAME_IN_LIST": getattr( - settings, "RELATE_DISPLAY_USER_FULLNAME_IN_LIST", False), }) # }}} diff --git a/course/grades.py b/course/grades.py index 6015c921..0c3eaa4c 100644 --- a/course/grades.py +++ b/course/grades.py @@ -159,11 +159,8 @@ def view_participant_list(pctx): .order_by("id") .select_related("user")) - from django.conf import settings return render_course_page(pctx, "course/gradebook-participant-list.html", { "participations": participations, - "RELATE_DISPLAY_USER_FULLNAME_IN_LIST": getattr( - settings, "RELATE_DISPLAY_USER_FULLNAME_IN_LIST", False), }) # }}} diff --git a/course/templates/course/participation-table.html b/course/templates/course/participation-table.html index ad3e26a7..80ee241a 100644 --- a/course/templates/course/participation-table.html +++ b/course/templates/course/participation-table.html @@ -3,12 +3,7 @@ <table class="table table-striped gradebook-participants"> <thead> <th class="datacol">{% trans "User ID" %}</th> - {% if RELATE_DISPLAY_USER_FULLNAME_IN_LIST %} - <th class="datacol">{% trans "Full Name" %}</th> - {% else %} - <th class="datacol">{% trans "Last Name" %}</th> - <th class="datacol">{% trans "First Name" %}</th> - {% endif %} + <th class="datacol">{% trans "Name" %}</th> <th class="datacol">{% trans "Role" %}</th> <th class="datacol">{% trans "Tags" %}</th> </thead> @@ -16,12 +11,7 @@ {% for participation in participations %} <tr> <td class="headcol"><a href="{% url "relate-view_participant_grades" course.identifier participation.id %}"><span class="sensitive">{{ participation.user.username }}</span></a></td> - {% if RELATE_DISPLAY_USER_FULLNAME_IN_LIST %} <td class="datacol"><span class="sensitive">{{ participation.user.get_full_name }}</span></td> - {% else %} - <td class="datacol"><span class="sensitive">{{ participation.user.last_name }}</span></td> - <td class="datacol"><span class="sensitive">{{ participation.user.first_name }}</span></td> - {% endif %} <td class="datacol">{{ participation.get_role_desc }}</td> <td class="datacol"> {% for ptag in participation.tags.all %} diff --git a/local_settings.py.example b/local_settings.py.example index a10c3129..6276d725 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -108,7 +108,7 @@ RELATE_EDITABLE_INST_ID_BEFORE_VERIFICATION = True # {{{ user full_name format -# RELATE's default fullname format is "'%s %s' % (first_name, last_name)", +# RELATE's default full_name format is "'%s %s' % (first_name, last_name)", # you can override it by supply a customized method/fuction, with # "firstname" and "lastname" as its paramaters, and return a string. @@ -133,25 +133,14 @@ RELATE_EDITABLE_INST_ID_BEFORE_VERIFICATION = True # ["first_name", "email", "username"], when first_name is not None # (e.g, first_name = "Foo"), the email will be opened # by "Dear Foo,". If first_name is None, then email will be used -# as appelation, so on and so force. +# as appelation, so on and so forth. -# you can override the appelation priority by supply a customized list, -# available list named RELATE_EMAIL_APPELATION_PRIORITY_LIST. The available +# you can override the appelation priority by supply a customized list +# named RELATE_EMAIL_APPELATION_PRIORITY_LIST. The available # elements include first_name, last_name, get_full_name, email and # username. -#RELATE_EMAIL_APPELATION_PRIORITY_LIST = ["first_name", "email", "username", "full_name"] - -# }}} - -# {{{ - -# When displayed in lists, user realname is diplayed by two fields, -# last_name and first_name, so that the bpth fields can be ordered. -# You can set the following configuration to True if you want to -# display name using full_name format. - -#RELATE_DISPLAY_USER_FULLNAME_IN_LIST = True +#RELATE_EMAIL_APPELATION_PRIORITY_LIST = ["full_name", "first_name", "email", "username"] # }}} diff --git a/relate/settings.py b/relate/settings.py index d2b811c9..142bccc5 100644 --- a/relate/settings.py +++ b/relate/settings.py @@ -287,9 +287,4 @@ if "RELATE_EMAIL_APPELATION_PRIORITY_LIST" in local_settings: assert isinstance( local_settings["RELATE_EMAIL_APPELATION_PRIORITY_LIST"], list) -# This makes sure RELATE_DISPLAY_USER_FULLNAME_IN_LIST is a bool -if "RELATE_DISPLAY_USER_FULLNAME_IN_LIST" in local_settings: - assert isinstance( - local_settings["RELATE_DISPLAY_USER_FULLNAME_IN_LIST"], bool) - # vim: foldmethod=marker -- GitLab