edge
edge copied to clipboard
Logging in using superuser raise django.core.urlresolvers.NoReverseMatch Exception
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
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.
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 %}
Thanks to @slmjy we now have a error message which points to this issue.