Wednesday, July 27, 2016

Re: Best way to keep the current selection

On 27 July 2016 at 02:02, Lee Hinde <leehinde@gmail.com> wrote:
> To maintain state, after any ad-hoc query, I store the ids for the found records:
>
> self.request.session['query.classes.last_ids'] = list(queryset.values_list('id', flat=True))

add a new model: Previous_Searchs or something like this, with
metadata on the search (user, date, sort critera, etc) and a many2many
link to the found records.

it makes it easy to repeat a search, keep it for longer, name it, or
even share it


--
Javier

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFkDaoQ7_0jHOFdoPUL3G6GizWvFZub354Vjcog-LTb3ZKQ8-A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment