1

I'm currently using Django Rest Auth to handle user registration. I would like to add the possibility to choose which group from the ones available (or if not possible which permission) associate to the user that it is currently been created.

I have accomplished something for the serializer, which i report below, but i don't know how to go on on the views (I suppose I should inherit the RegisterView class, but i'm not sure how).

from dj_rest_auth.registration.serializers import RegisterSerializer

class GroupSerializer(serializers.ModelSerializer):
class Meta:
    model = Group
    fields = ('pk',)


class RegistrationSerializer(RegisterSerializer):
    group = GroupSerializer(read_only=False, many=True)

I have searched for something already built-in in the package but it doesn't seems to exist.

  • 1
    please can you explain your question better, and in details, I may be able to answer your question, but I don't understand what you are trying to do – Opeyemi Odedeyi Apr 17 '20 at 07:12
  • 1
    Sure @OpeyemiOdedeyi. I currently have four groups. I would like to add the possibility on the registration endpoint provided by Django Rest Auth to let the client choose which group of the four assign to the user that he is adding. If that's not possible or too complicated an alternative solution could be assigning permisions as described in [this issue](https://github.com/Tivix/django-rest-auth/issues/587). – Francesco Pinzauti Apr 17 '20 at 10:22

0 Answers0