astrosat / django-astrosat-users

Common backend library for Astrosat projects' user management
GNU General Public License v3.0
2 stars 0 forks source link

consolidate separate Customer views & CustomerUser views into single views #79

Closed allynt closed 4 years ago

allynt commented 4 years ago

Checklist

Is your feature request related to a problem? Please describe

This isn't actually a problem. I suspect that the code will be cleaner if I were to consolidate the three separate CustomerUser views and two separate Customer views into single views or viewset.

However I'm not sure this is possible for 2 reasons:

It needs more thought.

Describe the solution you'd like

Maybe have the first lookup_arg specified in the URL route itself:

api_router.register("customers/{customer_id}/users", CustomerUserViewSet, basename="customer-users")

and have the second specified in the viewset attributes:

lookup_field = "user__uuid"
lookup_url_kwarg = "user_id"

I would still have to overwrite get_queryset and get_object.

Also add an extra @action for invitations.

allynt commented 4 years ago

Don't think this is possible. It's certainly not necessary.