Problem with migration to Django 1.8

28 views
Skip to first unread message

alessandr...@labcodes.com.br

unread,
Sep 13, 2016, 7:12:57 AM9/13/16
to Django users
Hello,

I'm currently trying to migrate a project from django 1.5.1 to the newest version. I got stuck in the version 1.7. The only test that is not passing was made to try to get the e-mail from an admin:

@pytest.mark.django_db
@pytest.mark.admin_client
def test_url_to_edit_object_admin(admin_client):


    user
= User.objects.get(username="admin")


    response
= admin_client.get(core_util.url_to_edit_object_admin(user))


   
assert response.status_code == 200
   
assert "ad...@example.com" in response.content


When the function url_to_edit_object_admin is called, it will try to reverse 'admin:auth_user_change' but on django 1.7 it does not work (Django 1.6 works just fine). I checked if this was deprecated from django 1.6, but I didn't find anything in the django documentation documentation.

The url_to_edit_object_admin function:

def url_to_edit_object_admin(object):
   
return reverse('admin:%s_%s_change' % (object._meta.app_label, object._meta.module_name),
                   args
=[object.id])



The error message:

E     NoReverseMatch: Reverse for 'auth_user_change' with arguments '(1,)' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Thanks!
Reply all
Reply to author
Forward
0 new messages