title: Django Rest Framework - Field username with ".", "-", "_" character
body: <p>I want allow from my backend API, that any user can be created with characters like <code>.</code>,<code>-</code>,<code>_</code>, <code>ñ</code> between others characters in their <code>username</code> field which is <code>primary_key=True,</code>.</p>
  
  <p>I define my custom user (<code>AbstractBaseUser</code>) of this way, in relation to <code>username</code> field which is of my interest:</p>
  
  <pre><code>class User(AbstractBaseUser, PermissionsMixin):
  
      username = models.CharField(
          _('username'),
          max_length=30,
          primary_key=True,
          unique=True,
          help_text=_('Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.'),
          validators=[
              RegexValidator(
                  r'^[\w.@+-]+$',
                  _('Enter a valid username. This value may contain only '
                    'letters, numbers ' 'and @/./+/-/_ characters.')
              ),
          ],
          error_messages={
              'unique': _("A user with that username already exists."),
          },
      )
      email = models.EmailField(max_length=254, unique=True)
      USERNAME_FIELD = 'email'
      REQUIRED_FIELDS = ['username']
      objects = UserManager()
  </code></pre>
  
  <p>My <code>UserSerializer</code> is this:</p>
  
  <pre><code>class UserSerializer(serializers.ModelSerializer):
      username = serializers.CharField(validators=[UniqueValidator(queryset=User.objects.all(), message='Lo sentimos, existe un fichaje con este nombre de usuario')])
      email = serializers.EmailField(validators=[UniqueValidator(queryset=User.objects.all(), message='Lo sentimos, alguien ya ha sido fichado con este correo electrónico')])
  
      class Meta:
          model = User
          fields = ('url', 'username', 'password', 'first_name','last_name',
                    'age','other fields ...',)
  </code></pre>
  
  <p>My UserViewSet is the following:</p>
  
  <pre><code>class UserViewSet(viewsets.ModelViewSet):
      """
      API endpoint that allows users to be viewed or edited.
      """
      queryset = User.objects.all().order_by('-date_joined')
      serializer_class = UserSerializer
      filter_fields = ('username', 'is_player', 'first_name', 'last_name', 'team' , 'email', )
  </code></pre>
  
  <p>The router is defined og this way in urls.py</p>
  
  <pre><code>router = routers.DefaultRouter()
  router.register(r'users', UserViewSet)
  </code></pre>
  
  <p>When I create an user with <code>.</code> character for example like <code>bacalao.cevichica</code> in te <code>username</code> field, the user is created, but when I go to <code>localhost:8000/api/users/</code></p>
  
  <p>I get this message:</p>
  
  <pre><code>File "/home/bgarcial/.virtualenvs/fuupbol2/lib/python3.5/site-packages/django/urls/resolvers.py", line 392, in _reverse_with_prefix
      (lookup_view_s, args, kwargs, len(patterns), patterns)
  django.urls.exceptions.NoReverseMatch: Reverse for 'user-detail' with arguments '()' and keyword arguments '{'pk': 'bacalao.cevichica'}' not found. 2 pattern(s) tried: ['api/users/(?P&lt;pk&gt;[^/.]+)\\.(?P&lt;format&gt;[a-z0-9]+)/?$', 'api/users/(?P&lt;pk&gt;[^/.]+)/$']
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/mrnOU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mrnOU.png" alt="enter image description here"></a></p>
  
  <p>I am not very familiarized with the regular expresions, and is possible that the <code>RegexValidator</code> is not well formed?</p>
  
  <p>Also, is possible that my problem is in the <code>UserSerializer</code> or <code>UserViewSet</code>.</p>
  
  <p>By the moment I have not clear this topic, any orientation is highly appreciated. :)</p>