SOLVED: by adding the cur_mgr ID to the get() kwargs.

On Mon, Dec 23, 2013 at 8:38 AM, Timothy W. Cook <[email protected]> wrote:

>
> (details below)
> I have a dashboard view and from there I want to perform various
> activities inside a portion of the page.
> So, I built a dashboard base template to reuse.  From the main index.html
> I call a view with the ID of the user
> (it is actually an internal role ID not the user id) which calls the
> dashboad that extends the dashboad base.
> However, now when I attempt to call one of these other views without using
> any parameters I get a NoReverse match error.
> For example, clicking on Add Project I get:
>
> NoReverseMatch at /papers/add_project/
> Reverse for 'mgr_dashboard' with arguments '()' and keyword arguments
> '{'pk': ''}' not found.
> 1 pattern(s) tried: ['mgr_dashboard/(?P<pk>\\d+)$']
>
> What is wrong with my design approach?  mgr_dashboard is being called from
> mgr_db_base.html without a parameter,
> even though it doesn't exist in add_project.html. It is already loaded.  I
> want to call some views with a cur_mgr.id and some without it.
> If I remove the tab (in mgr_db_base) for mgr_dashboard I get the same
> error for searchresult_list.html
>
> Thanks,
> Tim
>
> Code Details:
> mgr_db_base.html:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
>   {% load staticfiles i18n %}
> <head>
>     <title>SRE Manager Dashboard</title>
>     <meta http-equiv="content-type" content="text/html;
> charset=ISO-8859-1" />
>     <link type="text/css" rel="stylesheet" href="{% static
> 'css/mgr_dashboard.css' %}" />
> </head>
> <body>
>     <div id="main">
>
> {% block tabs %}
>         <div id="header">
>             <div class='logo'><a href="{% url 'home' %}"><img src="{%
> static "img/logo_sre258x214_grey_bg.png" %}" height='50' width="50"
> alt="SRE Logo" /></a></div>
>             <ul id="top-navigation">
>                 <li><a href="{% url 'mgr_dashboard' pk=cur_mgr.id %}"
> class="active">Projects</a></li>
>                 <li><a href="{% url 'searchresult_list' pk=cur_mgr.id %}"
> class="active">Search Results</a></li>
>                 <li><a href="{% url 'reviewers_list' pk=cur_mgr.id %}"
> class="active">Reviewer List</a></li>
>             </ul>
>         </div>
>  <div>
> {% endblock tabs %}
>
> {% block content %}
> {% endblock content %}
> </div>
>  </body>
> </html>
>
> mgr_dashboard.html:
> {% extends "mgr_db_base.html" %}
> {% load i18n %}
> {% load static from staticfiles %}
> {% block content %}
>
>             {% block mgr_content %}
>             {% block mgr_header %}
>             <div id="middle">
>             <div id="left-column">
>                 <p><a href="{% url 'add_project' %}" class="link">Add
> Projects</a></p>
>                 <p><a href="{% url 'add_searchresult' %}" class="link">Add
> Results Files</a></p>
>                 <p><a href="{% url 'add_reviewer' %}" class="link">Add
> Reviewers</a></p>
>             </div>
>             <div id="center-column">
>                 <div class="top-bar">
>                     {% if trial %}
>                        <div>Hello <span class="redfont">{{user.name}}</span>
> Your <span class="bluefont">FREE TRIAL</span> Expires: <span
> class="redfont">{{expires|date:"H:i Y-m-d"}}</span>
> </div>
>                     {% else %}
>                        <div>Hello <span class="redfont">{{user.name}}</span>
> Your Current Subscription Expires: <span
> class="redfont">{{expires|date:"H:i Y-m-d"}}</span> </div>
>                     {% endif %}
>                 </div>
>                 <div class="select-bar">
>                     <label>
>                         <input type="text" name="textfield" />
>                     </label>
>                     <label>
>                         <input type="submit" name="Submit" value="Search"
> />
>                     </label>
>                 </div>
>                 {% endblock mgr_header %}
>                 {% block mgr_details %}
>                 <div class="table">
>                     <table class="listing" cellpadding="2"
> cellspacing="2">
>                         <tr>
>                             <th>Project Name</th>
>                             <th>Description</th>
>                         </tr>
>                         {% for p in projects %}
>                         <tr>
>                             <td class="style1"><a href="{% url
> 'papers_list' pk=p.id %}">{{p.prj_name}}</a></td>
>                             <td>{{p.prj_descr}}</td>
>                         </tr>
>                        {% endfor %}
>                     </table>
>                 </div>
>                 {% endblock mgr_details %}
>
>                 {% block mgr_details2 %}
>
>                 {% endblock mgr_details2 %}
>             </div>
>             {% endblock %}
>
>         </div>
>  {% endblock %}
>
>  add_project.html:
>  {% extends "mgr_db_base.html" %}
> {% load i18n %}
> {% load static from staticfiles %}
> {% block content %}
>
>             {% block mgr_content %}
>             {% block mgr_header %}
>             <div id="middle">
>             <div id="left-column">
>             </div>
>             <div id="center-column">
>                 <div class="top-bar">
>                   <p class="bluefont">Create a New Project</p>
>                 </div>
>                 <div class="select-bar">
>
>                 </div>
>                 {% endblock mgr_header %}
>                 {% block mgr_details %}
>                 <div>
>                     {% if form.errors %}
>                        <p class="redfont">Invalid data. Please try
> again.</p>
>                     {% endif %}
>                     <form method="post" action="">
>                       {% csrf_token %}
>                       {{ form.as_p }}
>                       <input type="submit" value="Save New Project" />
>                     </form>
>                 </div>
>                 {% endblock mgr_details %}
>
>                 {% block mgr_details2 %}
>
>                 {% endblock mgr_details2 %}
>             </div>
>             {% endblock %}
>
>         </div>
>  {% endblock %}
>
>
> papers/urls.py
> """The urls for the papers app."""
> from django.conf.urls import patterns, url
>
> from papers.views import *
>
> urlpatterns = patterns(
>     '',
>     url(
>         r'^add_searchresult/$',
>         SearchResultCreateView.as_view(),
>         name='add_searchresult'
>     ),
>     url(
>         r'^searchresult_list/(?P<pk>\d+)$',
>         SearchResultListView.as_view(),
>         name='searchresult_list'
>     ),
>
>     url(
>         r'^reviewers_list/(?P<pk>\d+)$',
>         ReviewersListView.as_view(),
>         name='reviewers_list'
>     ),
>
>     url(
>         r'^searchresult_import/(?P<pk>\d+)$',
>         SearchResultImportView.as_view(),
>         name='searchresult_import'
>     ),
>
>     url(
>         r'^papers_list/(?P<pk>\d+)$',
>         PapersListView.as_view(),
>         name='papers_list'
>     ),
>
>     url(
>         r'^rvr_papers_list/(?P<pk>\d+)$',
>         RvrPapersListView.as_view(),
>         name='rvr_papers_list'
>     ),
>
>     url(
>         r'^paper_details_mgr/(?P<pk>\d+)$',
>         PaperDetailsMgrView.as_view(),
>         name='paper_details_mgr'
>     ),
>
>     url(
>         r'^add_project/$',
>         ProjectCreateView.as_view(),
>         name='add_project'
>     ),
>
>     url(
>         r'^add_reviewer/$',
>         ReviewerCreateView.as_view(),
>         name='add_reviewer'
>     ),
>
>     url(
>         r'^review_title/(?P<pk>\d+)$',
>         ReviewTitleCreateView.as_view(),
>         name='review_title'
>     ),
>
>     url(
>         r'^review_abstract/(?P<pk>\d+)$',
>         ReviewAbstractCreateView.as_view(),
>         name='review_abstract'
>     ),
>
>     url(
>         r'^review_fulltext/(?P<pk>\d+)$',
>         ReviewFulltextCreateView.as_view(),
>         name='review_fulltext'
>     ),
>
>
> )
>
>
> --
> MLHIM VIP Signup: http://goo.gl/22B0U
> ============================================
> Timothy Cook, MSc           +55 21 94711995
> MLHIM http://www.mlhim.org
> Like Us on FB: https://www.facebook.com/mlhim2
> Circle us on G+: http://goo.gl/44EV5
> Google Scholar: http://goo.gl/MMZ1o
> LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook
>



-- 
MLHIM VIP Signup: http://goo.gl/22B0U
============================================
Timothy Cook, MSc           +55 21 94711995
MLHIM http://www.mlhim.org
Like Us on FB: https://www.facebook.com/mlhim2
Circle us on G+: http://goo.gl/44EV5
Google Scholar: http://goo.gl/MMZ1o
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3Uv8z82L3d7AkZkcWprmUU73n3a2TyyKJJ0zPuPseaFfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to