Merge lp:~james-w/summit/usability into lp:summit

Proposed by James Westby
Status: Merged
Approved by: Michael Hall
Approved revision: 203
Merged at revision: 210
Proposed branch: lp:~james-w/summit/usability
Merge into: lp:summit
Diff against target: 127 lines (+51/-7)
5 files modified
summit/schedule/admin/attendeeadmin.py (+17/-2)
summit/schedule/admin/roomadmin.py (+1/-0)
summit/schedule/models/agendamodel.py (+8/-1)
summit/schedule/models/attendeemodel.py (+1/-1)
summit/schedule/models/participantmodel.py (+24/-3)
To merge this branch: bzr merge lp:~james-w/summit/usability
Reviewer Review Type Date Requested Status
Michael Hall (community) Approve
Review via email: mp+80108@code.launchpad.net

Commit message

Usability fixes for summit admin

Description of the change

Hi,

After helping someone do some things in the admin site earlier I felt compelled
to make these changes.

The change the attendee __unicode__ is likely the most important, as without
it each user gets one entry in the attendee select when creating a participant.
This means that it essentially picks a random summit for the attendee, and so
you can end up with a participant for completely different summit to the one
that the meeting is in. Without this change it is impossible to reliably
add a participant through the admin site.

The rest just improve the widgets, or add some help text to explain some
of the options, so people don't set them to the wrong thing.

Thanks,

James

To post a comment you must log in.
Revision history for this message
Michael Hall (mhall119) wrote :

Looks good

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'summit/schedule/admin/attendeeadmin.py'
2--- summit/schedule/admin/attendeeadmin.py 2010-10-06 00:24:20 +0000
3+++ summit/schedule/admin/attendeeadmin.py 2011-10-21 21:15:27 +0000
4@@ -16,7 +16,7 @@
5
6 from django.contrib import admin
7
8-from summit.schedule.models import Attendee, AttendeeBusy, Participant
9+from summit.schedule.models import Attendee, AttendeeBusy, Participant, Meeting
10
11 __all__ = (
12 )
13@@ -35,6 +35,21 @@
14 'user__email')
15 inlines = (AttendeeBusyInline, )
16
17+
18+class ParticipantAdmin(admin.ModelAdmin):
19+ list_display = ('meeting', 'attendee', 'required')
20+ list_display_links = ('attendee', )
21+ search_fields = ('attendee__user__username', 'attendee__user__first_name', 'attendee__user__last_name',
22+ 'attendee__user__email', 'meeting__name', 'meeting__title')
23+
24+ def formfield_for_foreignkey(self, db_field, request, **kwargs):
25+ if db_field.name == "meeting":
26+ kwargs["queryset"] = Meeting.objects.order_by('name')
27+ if db_field.name == "attendee":
28+ kwargs["queryset"] = Attendee.objects.order_by('user__username')
29+ return super(ParticipantAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
30+
31+
32 admin.site.register(Attendee, AttendeeAdmin)
33
34-admin.site.register(Participant)
35+admin.site.register(Participant, ParticipantAdmin)
36
37=== modified file 'summit/schedule/admin/roomadmin.py'
38--- summit/schedule/admin/roomadmin.py 2011-09-15 20:48:07 +0000
39+++ summit/schedule/admin/roomadmin.py 2011-10-21 21:15:27 +0000
40@@ -32,6 +32,7 @@
41 list_display_links = ('name', 'title')
42 list_filter = ('summit', 'type', 'tracks', 'size')
43 search_fields = ('name', 'title')
44+ filter_horizontal = ('tracks',)
45
46 fieldsets = (
47 (None, {
48
49=== modified file 'summit/schedule/models/agendamodel.py'
50--- summit/schedule/models/agendamodel.py 2010-03-05 10:33:36 +0000
51+++ summit/schedule/models/agendamodel.py 2011-10-21 21:15:27 +0000
52@@ -25,11 +25,18 @@
53 )
54
55
56+HELP_TEXT = {
57+ "auto": ("Whether the meeting was autoscheduled. If this is not "
58+ "set then the meeting was scheduled by hand."),
59+}
60+
61+
62 class Agenda(models.Model):
63 slot = models.ForeignKey(Slot)
64 room = models.ForeignKey(Room)
65 meeting = models.ForeignKey(Meeting)
66- auto = models.BooleanField(default=False)
67+ auto = models.BooleanField(default=False,
68+ help_text=HELP_TEXT["auto"])
69
70 class Meta:
71 app_label = 'schedule'
72
73=== modified file 'summit/schedule/models/attendeemodel.py'
74--- summit/schedule/models/attendeemodel.py 2011-09-17 17:23:10 +0000
75+++ summit/schedule/models/attendeemodel.py 2011-10-21 21:15:27 +0000
76@@ -51,7 +51,7 @@
77 ordering = ('summit', 'user')
78
79 def __unicode__(self):
80- return self.user.username
81+ return "%s (%s)" % (self.user.username, self.summit.name)
82
83 def _get_start(self):
84 return self.summit.localize(self.start_utc)
85
86=== modified file 'summit/schedule/models/participantmodel.py'
87--- summit/schedule/models/participantmodel.py 2011-10-18 19:17:05 +0000
88+++ summit/schedule/models/participantmodel.py 2011-10-21 21:15:27 +0000
89@@ -24,14 +24,35 @@
90 )
91
92
93+HELP_TEXT = {
94+ "attendee": ("Be sure to choose the attendee from the correct "
95+ "event. If the person is not listed for the event in question "
96+ "then they are not known to be attending yet, and have to "
97+ "sign up to attend."),
98+ "required": ("The person is required to attend the session. "
99+ "If this is set the scheduler will attempt to ensure that "
100+ "the person is able to attend. If it is not checked then "
101+ "the scheduler won't consider the person when deciding "
102+ "where the meeting can go on the schedule."),
103+ "from_launchpad": ("Set to indicate the participant comes from "
104+ "a subscription to the Launchpad blueprint. Don't set this "
105+ "if you are adding the participant, as they may end up "
106+ "getting deleted if you do."),
107+}
108+
109+
110 class Participant(models.Model):
111 meeting = models.ForeignKey(Meeting)
112- attendee = models.ForeignKey(Attendee)
113- required = models.BooleanField(default=False)
114- from_launchpad = models.BooleanField(default=False)
115+ attendee = models.ForeignKey(Attendee,
116+ help_text=HELP_TEXT["attendee"])
117+ required = models.BooleanField(default=False,
118+ help_text=HELP_TEXT["required"])
119+ from_launchpad = models.BooleanField(default=False,
120+ help_text=HELP_TEXT["from_launchpad"])
121
122 class Meta:
123 app_label = 'schedule'
124+ ordering = ('meeting', 'attendee', 'required')
125
126 def __unicode__(self):
127 return self.attendee.user.username

Subscribers

People subscribed via source and target branches