edge icon indicating copy to clipboard operation
edge copied to clipboard

Logging in using superuser raise django.core.urlresolvers.NoReverseMatch Exception

Open idanshimon opened this issue 10 years ago • 3 comments

When trying to login to the regular site (not the admin) using the superuser account i get this error: NoReverseMatch: Reverse for 'show' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: [u'users/(?P[\w-]+)$']

idanshimon avatar Aug 10 '15 11:08 idanshimon

Found the issue, when running migrate the profiles tables were not created causing an error when creating a new super user

django.db.utils.ProgrammingError: (1146, "Table 'test.profiles_profile' doesn't exist")

Solution was to run from the src directory: python manage.py makemigrations

and then run migrate again: python manage.py migrate

then create another superuser and everything should be ok. You can delete the old user and recreate it.

idanshimon avatar Aug 10 '15 11:08 idanshimon

The underlying problem is that slug attribute for user profile is not created, if migrations were executed incorrectly, as described above.

The solution in edge could be somethin like this in src/profiles/templates/profiles/show_profile.html

{% if show_user.profile.slug %}
    <a href="{% url 'profiles:show' show_user.profile.slug %}">
        <span class="glyphicon glyphicon-link" aria-hidden="true" title="Profile permalink"></span>
        <span class="sr-only">Permalink</span></a> {{ show_user.profile.get_absolute_url }}
{% else %}
            <a href="https://github.com/arocks/edge/issues/40">No permalink. See this issue.</a>
{% endif %}

slmjy avatar Sep 04 '15 18:09 slmjy

Thanks to @slmjy we now have a error message which points to this issue.

arocks avatar Dec 13 '15 06:12 arocks