os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sym.settings') in views. I only have that in views.py.
Exception Type:
NoReverseMatch
Exception Value:
Reverse for 'rrs_class_lists_faculty' with arguments '()' and keyword arguments '{'faculty_id': ''}' not found. 1 pattern(s) tried: ['rrs/class_lists_faculty/(?P<faculty_id>[-\\w]+)/$']
<td class="col-xs-12">{{ forloop.counter }}. <a href="{% url 'rrs_class_lists_faculty' faculty_id=faculty_name.1 %}" target="_blank">{{ faculty_name.0 }}</a></td>
return render(request, 'rrs_class_list_summary.html', {'errorLS': errorLS, 'feedbackLS': feedbackLS,
'faculty_link_name_list': faculty_link_name_list,...
})
url(r'^class_lists_faculty/(?P<faculty_id>[-\w]+)/$', rrs_views.requires_login(rrs_views.class_lists_faculty), name="rrs_class_lists_faculty"),
def class_lists_faculty(request, faculty_id=''):
<a href="{% url 'rrs_class_lists_summary' %}{{ faculty_name.1 }}/" target="_blank">{{ faculty_name.0 }}
url(r'^class_lists_summary/$', rrs_views.requires_login(rrs_views.class_lists_summary), name="rrs_class_lists_summary"),
url(r'^class_lists_summary/(?P<faculty_id>[-\w]+)/$', rrs_views.requires_login(rrs_views.class_lists_faculty), name="rrs_class_lists_summary"),
On Monday 08 May 2017 12:46:43 ludovic coues wrote:
> I'm a bit surprised by the error message showing
> (?P<faculty_id>[-\w]+) with two \ while your url only use one.
No, that's normal since a few releases, that backslashes in backtraces are escaped. Don't ask me why, I've learned to read it and didn't dive down the rabbit hole.
--
Melvyn Sopacua
On Monday 08 May 2017 03:16:30 miguel vfx wrote:
> I got it to work but with a different approach by not passing
> arguments:
This isn't the right fix, something else changed. The error message shows that faculty_name.1 was empty. If the fix works, the old code should work as well. It's probably the data that changed - but you're not showing the for loop and view part that fills faculty_name.
> >> Reverse for 'rrs_class_lists_faculty' with arguments '()' and
> >> keyword
> >> arguments '{'faculty_id': ''}' not found.
--
Melvyn Sopacua
Just a shot in the dark - if you're rendering choices for a choice field, then this would be empty for the "I didn't pick anything" option indicated by '---------'. To fix it use forloop.first to not render the url tag, check for emptiness or use the |default: template filter.
--
Melvyn Sopacua