Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ordering Profiles #193

Closed
Brandogs opened this issue Oct 3, 2017 · 4 comments
Closed

Ordering Profiles #193

Brandogs opened this issue Oct 3, 2017 · 4 comments

Comments

@Brandogs
Copy link
Contributor

Brandogs commented Oct 3, 2017

Feature Proposal

Profiles need to be able to be reordered manually. The default profile to load should be the first in the list.

We should add sort_by field to determine the order the profiles appear and remote the default profile field.

@cdriehuys
Copy link
Member

This will require a few changes.

  1. The Profile model needs a new field called order. This will be an IntegerField that is unique with the model's km_user field. We need to make sure this field is correctly populated when a new profile is created.
  2. We need a serializer that takes an array of IDs and sets the order field from the data
  3. We need a view that exposes the ordering serializer

Items 2 and 3 would ideally be generic solutions because we also need to apply this ordering logic to profile topics and profile items in the future.

@cdriehuys
Copy link
Member

Django has a built-in mechanism for dealing with this that might be useful.

@cdriehuys
Copy link
Member

As far as modifying the order goes, I think our best option is a PUT request to the list endpoint with an array of the profiles' primary keys in the desired order. The collections we're dealing with are small enough that it's not a pain to specify the order of the entire collection, and our traffic is low enough that I don't think concurrent requests will be a problem.

@Brandogs
Copy link
Contributor Author

Brandogs commented Apr 2, 2018

Sounds good to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants