Q:

NoReverseMatch at /

Django 1.7.0 beta 4
Python 2.7.9  
I'm currently trying to use Django's CBVs to create modals.  I had no problem with the ListView, but I'm stuck when trying to call my UpdateView using url tags. 
I'm getting the following error:  

NoReverseMatch at /dashboard_usuario_list/
  Reverse for 'dashboard_usuario_edit' with arguments '(u'test2',)' and keyword arguments '{}' not found.  1 pattern(s) tried: ['dashboard_usuario_edit/(?Pd+)/?$']  

views.py:  
class UserProfileListView(ListView):
    model = UserProfile
    template_name = 'dashboard_usuario_list.html'
    def get_queryset(self):
        return UserProfile.objects.all()

class UserProfileUpdateView(UpdateView):
    model = UserProfile
    form_class = UserProfileForm
    template_name = 'dashboard_usuario_edit.html'

    def dispatch(self, *args, **kwargs):
        self.username = kwargs['username']
        return super(UserProfileUpdateView, self).dispatch(*args, **kwargs)

    def form_valid(self, form):
        """
        If the form is valid, redirect to the supplied URL. 
        """
        form.save()
        user_profile = UserProfile.objects.get(username = self.username)
        return HttpResponse(render_to_string('dashboard_usuario.html', {'username':user_profile}))

    def get_context_data(self, **kwargs):
        context = super(UserProfileUpdateView, self).get_context_data(**kwargs)
        return context

url.py:  
url(r'^dashboard_usuario_list/', views. UserProfileListView.as_view(), name = 'dashboard_usuario_list'),
url(r'^dashboard_usuario_edit/(?P<username>d+)/?$', views. UserProfileUpdateView.as_view(), name = 'dashboard_usuario_edit'),

dashboard_usuario_list.html:
<a href="{% url 'dashboard_usuario_edit' user.user.username %}"></a> 
Thanks in advance! 

A:

The url for dashboard_usuario_edit has regex pattern to accept only integers \d+ as username, which is wrong, username can consist of alpha numeric characters, so your pattern should be:
url(r'^dashboard_usuario_edit/(?P<username>[\w.@+-]+)/?$', views. UserProfileUpdateView.as_view(), name = 'dashboard_usuario_edit'),

