Commit 03cdfa83 by tasawernawaz Committed by Tasawer Nawaz

make current user default course team admin

ECOM-7496
parent c1225fe8
......@@ -165,6 +165,7 @@ class CustomCourseForm(CourseForm):
).order_by(Lower('key'))
self.declared_fields['organization'].queryset = organizations
self.declared_fields['team_admin'].widget.attrs = {'data-user': user.id}
super(CustomCourseForm, self).__init__(*args, **kwargs)
if edit_mode:
......
......@@ -21,7 +21,8 @@ function loadAdminUsers(org_id) {
success: function (data) {
var teamAdminDropDown = $('#id_team_admin'),
selectedTeamAdmin = $('#id_team_admin option:selected').val(),
organizationInputType = $('#id_organization').attr('type');
organizationInputType = $('#id_organization').attr('type'),
currentUser = teamAdminDropDown.data('user');
teamAdminDropDown.empty();
if (organizationInputType == 'hidden' ) {
......@@ -32,7 +33,7 @@ function loadAdminUsers(org_id) {
}
$.each(data.results, function (i, user) {
if (selectedTeamAdmin == user.id && organizationInputType === 'hidden' ) {
if ((selectedTeamAdmin == user.id && organizationInputType === 'hidden') || currentUser == user.id) {
teamAdminDropDown.append(
$('<option selected="selected"> </option>').val(user.id).html(user.full_name)
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment