Merge lp:~ronnie.vd.c/loco-team-portal/627492 into lp:loco-team-portal

Proposed by Ronnie on 2010-12-16
Status: Merged
Approved by: Chris Johnston on 2011-01-05
Approved revision: 351
Merged at revision: 353
Proposed branch: lp:~ronnie.vd.c/loco-team-portal/627492
Merge into: lp:loco-team-portal
Diff against target: 122 lines (+47/-13)
3 files modified
loco_directory/meetings/forms.py (+23/-0)
loco_directory/meetings/views.py (+2/-2)
loco_directory/teams/forms.py (+22/-11)
To merge this branch: bzr merge lp:~ronnie.vd.c/loco-team-portal/627492
Reviewer Review Type Date Requested Status
Ronnie Resubmit on 2011-01-05
Chris Johnston 2010-12-16 Needs Fixing on 2011-01-05
Review via email: mp+43988@code.launchpad.net

Description of the Change

owner, admin and contact profiles in team_edit are now grouped (optgroups) in "Team members" (the members in the team that is edited) and "Other members"

This makes it easier to assign the right people

To post a comment you must log in.
Chris Johnston (cjohnston) wrote :

"Other members" should be renamed. They aren't members. Also, the meeting chair needs to be included in this.

review: Needs Fixing
346. By Ronnie on 2010-12-19

Sorting Team_members/other_members now works also in meetings.chair

Ronnie (ronnie.vd.c) wrote :

"Other members" is now renamed to "Other users"

347. By Ronnie on 2010-12-23

Changed 'Other members' to 'Other users'

Chris Johnston (cjohnston) wrote :

If there is no user assigned, it needs to default null. Example: when creating a meeting, it should default to ----- or something similar.. Currently it defaults to the first user of the team.

review: Needs Fixing
348. By Ronnie on 2011-01-03

Default is now '---------'

349. By Ronnie on 2011-01-03

less '----'. the amount is now equal as on other parts of the website

Chris Johnston (cjohnston) wrote :

Based upon our conversation on IRC, leave the null on contacts, however remove the null on owner and admin please.

review: Needs Fixing
Ronnie (ronnie.vd.c) wrote :

The contacts box does not need a null in my opinion. Its a multi selectbox, where you can select nothing. Currently the field does not allow 'null' so that should be fixed in the model and form, but not by adding a '---------' field

Chris Johnston (cjohnston) wrote :

There is still '----' on all fields on the team details page.

review: Needs Fixing
Ronnie (ronnie.vd.c) wrote :

Committed the changes. It should be solved now

review: Resubmit
350. By Ronnie on 2011-01-05

Teams edit page: renmoved '--------'

351. By Ronnie on 2011-01-05

Added default teams channel to the meeting page

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/meetings/forms.py'
2--- loco_directory/meetings/forms.py 2010-12-06 01:51:30 +0000
3+++ loco_directory/meetings/forms.py 2011-01-05 13:41:37 +0000
4@@ -6,6 +6,7 @@
5
6 from models import BaseMeeting, TeamMeeting
7 from common.forms import RenderableMixin
8+from userprofiles.models import UserProfile
9
10 import pytz
11
12@@ -38,12 +39,14 @@
13 self.fields['date_begin'].widget = forms.SplitDateTimeWidget()
14 self.fields['date_end'].widget = forms.SplitDateTimeWidget()
15
16+
17 def clean(self):
18 begin = self.cleaned_data.get('date_begin')
19 end = self.cleaned_data.get('date_end')
20 if begin and end and begin > end:
21 raise forms.ValidationError("Meetings can not end before they start.")
22 return self.cleaned_data
23+
24
25 class TeamMeetingForm(BaseMeetingForm):
26 """
27@@ -52,3 +55,23 @@
28 class Meta(BaseMeetingForm.Meta):
29 model = TeamMeeting
30 exclude = ('teams', 'date_created')
31+
32+ def __init__(self, team=None, *args, **kargs):
33+ super(TeamMeetingForm, self).__init__(*args, **kargs)
34+ if team:
35+ self.fields['chair'].choices = self.grouped_user_list([team])
36+ self.fields['channel'].initial = team.irc_chan
37+ elif self.instance:
38+ teams = [team for team in self.instance.teams.all()]
39+ self.fields['chair'].choices = self.grouped_user_list(teams)
40+
41+ def grouped_user_list(self, teams):
42+ other_members, team_members = [], []
43+ for profile in UserProfile.objects.filter(user__groups__name__in=teams):
44+ team_members.append((profile.id, str(profile)))
45+ for profile in UserProfile.objects.all().exclude(user__groups__name__in=teams):
46+ other_members.append((profile.id, str(profile)))
47+ return [('', '---------'),
48+ (_('Team members'), team_members),
49+ (_('Other users'), other_members)]
50+
51
52=== modified file 'loco_directory/meetings/views.py'
53--- loco_directory/meetings/views.py 2010-12-06 16:22:09 +0000
54+++ loco_directory/meetings/views.py 2011-01-05 13:41:37 +0000
55@@ -173,14 +173,14 @@
56
57 if is_on_lc or is_member:
58 if request.method == 'POST':
59- form = TeamMeetingForm(data=request.POST)
60+ form = TeamMeetingForm(data=request.POST, team=team_object)
61 if form.is_valid():
62 team_meeting = form.save()
63 team_meeting.teams.add(team_object)
64 request.user.message_set.create(message=_('New meeting created.'))
65 return redirect( team_object )
66 else:
67- form = TeamMeetingForm()
68+ form = TeamMeetingForm(team=team_object)
69
70 context = {
71 'team_object': team_object,
72
73=== modified file 'loco_directory/teams/forms.py'
74--- loco_directory/teams/forms.py 2010-11-20 17:40:31 +0000
75+++ loco_directory/teams/forms.py 2011-01-05 13:41:37 +0000
76@@ -4,6 +4,7 @@
77 from django.utils.translation import ugettext_lazy as _
78
79 from models import Team
80+from userprofiles.models import UserProfile
81 from common.forms import RenderableMixin
82
83 class UpdateTeamForm(forms.ModelForm, RenderableMixin):
84@@ -18,18 +19,28 @@
85 js = (
86 '/media/js/colortip-1.0-jquery.js',
87 )
88-
89-class LoCoCouncilForm(forms.ModelForm, RenderableMixin):
90- class Meta:
91+
92+ def __init__(self, *args, **kwargs):
93+ super(UpdateTeamForm, self).__init__(*args, **kwargs)
94+ user_list = self.grouped_user_list()
95+ self.fields['owner_profile'].choices = user_list
96+ self.fields['admin_profiles'].choices = user_list
97+ self.fields['contact_profiles'].choices = user_list
98+
99+ def grouped_user_list(self):
100+ other_members, team_members = [], []
101+ for profile in UserProfile.objects.filter(user__groups__name__exact=self.instance.lp_name):
102+ team_members.append((profile.id, str(profile)))
103+ for profile in UserProfile.objects.all().exclude(user__groups__name__exact=self.instance.lp_name):
104+ other_members.append((profile.id, str(profile)))
105+
106+ return [(_('Team members'), team_members),
107+ (_('Other users'), other_members)]
108+
109+
110+class LoCoCouncilForm(UpdateTeamForm, RenderableMixin):
111+ class Meta(UpdateTeamForm.Meta):
112 model = Team
113 exclude = ('approved', 'expires_date', 'name', 'lp_name', 'admins', 'owner', 'active')
114
115- class Media:
116- css = {'all': (
117- '/media/css/colortip-1.0-jquery.css',
118- )}
119- js = (
120- '/media/js/colortip-1.0-jquery.js',
121- )
122-
123

Subscribers

People subscribed via source and target branches