Hi Daryl, The sortable flag only works for fields that are actually in the database. For the full name, we're actually just calling a function that pieces together a couple strings from the database, so we can't really sort on it. It should work for last_login though.
I'm guessing there was just some odd caching problem when trying to change it back, or the server wasn't reloaded. Having it on last_login should be fine. As for expand, that's to control whether it takes up as much space as possible, width-wise. The summary column is expanded, for example. You wouldn't want it here. Are you testing with the dev server, or an install? Christian -- Christian Hammond - [email protected] Review Board - http://www.reviewboard.org VMware, Inc. - http://www.vmware.com On Mon, Jun 13, 2011 at 5:26 AM, Daryl <[email protected]> wrote: > The only changes I've made are to SubmitterDataGrid. I added a column > for last_login and added that column to the self.default_columns > below. Disclaimer - the only other python code I've written is a tab- > space patch for RB. :) So I'm in the dark. I searched through the > code and found template/reviews/user_page.html using user.last_login > so I guessed at the line below where I set field_name="last_login". > > Now what I recall is I added sortable=True to fullname and > pending_count, tested, and got an error. I then removed those but > left sortable=True for last_login. It still failed for my normal > account. But when I logged in as admin it works. I now just logged > in as another non-admin account, and the Submitter page comes up ok. > Now I do remember also putting an expand=True (or maybe it was > shrink=True) on the new last_login line. I don't know what they mean > so I removed them. But I did do a test with it in there. Perhaps > adjusting the column width? Anyhow, if need be I can put in those > changes again and try to view it with one of the working accounts to > see if it reproduces it. But perhaps I'll wait for you to reply on if > what I have below is just wrong. > > Daryl > > username = Column(_("Username"), link=True, sortable=True) > fullname = Column(_("Full Name"), field_name="get_full_name", > link=True, expand=True) > pending_count = PendingCountColumn(_("Pending Reviews"), > > field_name="directed_review_requests", > shrink=True) > last_login = Column(_("Last Login"), field_name="last_login", > sortable=True) > > <snip> > > self.default_columns = [ > "username", "fullname", "pending_count", "last_login" > ] > > > On Jun 13, 2:40 am, Christian Hammond <[email protected]> wrote: > > I'm a bit confused by this. Can you show me what the code you're adding > > looks like? > > > > Christian > > > > -- > > Christian Hammond - [email protected] > > Review Board -http://www.reviewboard.org > > VMware, Inc. -http://www.vmware.com > > > > > > > > > > > > > > > > On Sun, Jun 12, 2011 at 7:59 PM, Daryl <[email protected]> wrote: > > > Mercy. Ok, I've been able to add it and it works with a 2nd account. > > > But initially I added sortable=True to to fullname, pending_count and > > > last_login. It didn't like that. So I removed sortable from fullname > > > and pending_count. And now it works with the 2nd account. But it > > > seems like something is cached with the first account since I keep > > > getting the 500 - something broke error with the below trace. I > > > assumed something was cached, but I've tried: > > > > > - Restarting apache > > > - Restarting memcache > > > - Clearing memcache using echo "flush_all" | nc localhost 11211 > > > - Restarting sqld > > > - rb-site manage upgrade . > > > - Clearing browser cache > > > > > It's my normal review account that I was first testing the changes > > > that keep giving me the error. With the admin account "Last Login" > > > shows up and I can sort by it. Frustrating .. any thoughts? > > > > > Thanks, > > > Daryl > > > > > Traceback (most recent call last): > > > > > File "/usr/lib/python2.4/site-packages/Django-1.3-py2.4.egg/django/ > > > core/handlers/base.py", line 111, in get_response > > > response = callback(request, *callback_args, **callback_kwargs) > > > > > File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6beta2.1- > > > py2.4.egg/reviewboard/accounts/decorators.py", line 25, in _check > > > return login_required(view_func)(*args, **kwargs) > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/auth/util.py", line 46, in _checklogin > > > return view_func(request, *args, **kwargs) > > > > > File "/usr/lib/python2.4/site-packages/ReviewBoard-1.6beta2.1- > > > py2.4.egg/reviewboard/reviews/views.py", line 504, in submitter_list > > > return grid.render_to_response(template_name) > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/datagrid/grids.py", line 699, in render_to_response > > > self.load_state() > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/datagrid/grids.py", line 534, in load_state > > > self.precompute_objects() > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/datagrid/grids.py", line 631, in precompute_objects > > > self.rows = [ > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/datagrid/grids.py", line 210, in render_cell > > > rendered_data = self.render_data(obj) > > > > > File "/usr/lib/python2.4/site-packages/Djblets-0.6.7-py2.4.egg/ > > > djblets/datagrid/grids.py", line 253, in render_data > > > if id_field in obj.__dict__: > > > > > AttributeError: 'NoneType' object has no attribute '__dict__' > > > > > On Jun 12, 1:59 am, Christian Hammond <[email protected]> wrote: > > > > Hi Daryl, > > > > > > The Submitters page has been around since basically month 2 of Review > > > Board, > > > > but probably isn't that frequently used. I'd be happy to accept a > patch > > > for > > > > showing the last login time. The code for this is in > > > > reviewboard/reviews/datagrids.py. You'll add a new field to > > > > SubmitterDataGrid, named the same as the field containing this > > > information > > > > in the model. Feel free to play with it, and then submit it for > review > > > athttp://reviews.reviewboard.org/ > > > > > > Christian > > > > > > -- > > > > Christian Hammond - [email protected] > > > > Review Board -http://www.reviewboard.org > > > > VMware, Inc. -http://www.vmware.com > > > > > > On Sat, Jun 11, 2011 at 9:53 PM, Daryl <[email protected]> > wrote: > > > > > I'm running 1.6 beta 2 now and I like the changes a lot. Not sure > if > > > > > the Submitters button is new, I don't remember seeing it before. I > > > > > like being able to see a list of all users and the number of > pending > > > > > reviews. It would also be nice to see the last time someone logged > in > > > > > on the summary page but it's not an option for customization. It > does > > > > > show up if you click an individual user. I suppose this is a > feature > > > > > request. Any chance there's a way I can add it without much > > > > > difficulty? I suppose I could start digging around. Maybe a > pointer > > > > > or two in the right direction.. > > > > > > > Thanks, > > > > > Daryl > > > > > > > -- > > > > > Want to help the Review Board project? Donate today at > > > > >http://www.reviewboard.org/donate/ > > > > > Happy user? Let us know athttp://www.reviewboard.org/users/ > > > > > -~----------~----~----~----~------~----~------~--~--- > > > > > To unsubscribe from this group, send email to > > > > > [email protected] > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/reviewboard?hl=en > > > > > -- > > > Want to help the Review Board project? Donate today at > > >http://www.reviewboard.org/donate/ > > > Happy user? Let us know athttp://www.reviewboard.org/users/ > > > -~----------~----~----~----~------~----~------~--~--- > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/reviewboard?hl=en > > -- > Want to help the Review Board project? Donate today at > http://www.reviewboard.org/donate/ > Happy user? Let us know at http://www.reviewboard.org/users/ > -~----------~----~----~----~------~----~------~--~--- > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/reviewboard?hl=en > -- Want to help the Review Board project? Donate today at http://www.reviewboard.org/donate/ Happy user? Let us know at http://www.reviewboard.org/users/ -~----------~----~----~----~------~----~------~--~--- To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/reviewboard?hl=en
