title: view function() takes exactly 2 arguments (1 given)
body: <p>I'm pretty new to Django, and I've spent hours trying possible solutions to this.<br>
  My view takes a kwarg:</p>
  
  <pre><code>def inventory(request, id):
      model = Inventory
      # thing = Inventory.objects.get(pk=id) 
      if request.method == "POST":
          stuff = Inventory.objects.get(id=id)
          form = InventoryForm(data = request.POST, instance=stuff) 
          if form.is_valid():
              # if Inventory.filter(item='item').exists()
              # obj = form.save(commit=False)
              form.save()
  
      else:
          stuff = Inventory.objects.get(id=id)
          form = InventoryForm(instance=stuff)
      context = RequestContext(request)
      return render_to_response('inventory.html', {
              'form':form, 'stuff':stuff
              }, RequestContext(request))
  </code></pre>
  
  <p>When I try the following url pattern:</p>
  
  <pre><code> url(r'^inventory/(?P&lt;id&gt;\d+)/$', inventory, kwargs=dict(model=models.Inventory) name ='inventory'),
  </code></pre>
  
  <p>I get a 404.</p>
  
  <p>This url pattern:</p>
  
  <pre><code>url(r'^inventory/$', inventory, name='inventory'), 
  </code></pre>
  
  <p>Gives me the following error:</p>
  
  <p>inventory() takes exactly 2 arguments (1 given)</p>
  
  <p>What is the correct syntax here?</p>
  
  <p>Edited to add that this url was working until I added the code allowing the user to edit in addition to add content. </p>
  
  <p>ETA traceback from the new error I get when trying the suggestions below:</p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://localhost:8000/inventory/16/
  
  Django Version: 1.8
  Python Version: 2.7.6
  Installed Applications:
  ('django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'django_tables2',
   'camp')
  Installed Middleware:
  ('django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware',
   'django.middleware.security.SecurityMiddleware')
  
  
  Template error:
  In template /Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/bioluminati/camp/templates/base.html, error at line 58
     Reverse for 'inventory' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: ['inventory/(?P&lt;id&gt;\\d+)/$']
  
     48 :                 &lt;/ul&gt;
  
  
  
     49 :               &lt;/li&gt;
  
  
  
     50 :               &lt;li&gt;&lt;a href="#"&gt;Setup and Exedus&lt;/a&gt;
  
  
  
     51 :                 &lt;ul&gt;
  
  
  
     52 :                   &lt;li&gt;&lt;a href="#"&gt;Sign up for shifts&lt;/a&gt;&lt;/li&gt;
  
  
  
     53 :                   &lt;li&gt;&lt;a href="#"&gt;Instructions and plans for setup&lt;/a&gt;&lt;/li&gt;
  
  
  
     54 :                 &lt;/ul&gt;   
  
  
  
     55 :               &lt;/li&gt;
  
  
  
     56 :               &lt;li&gt;&lt;a href="#"&gt;Operations&lt;/a&gt;
  
  
  
     57 :                 &lt;ul&gt;
  
  
  
     58 :                   &lt;li&gt;&lt;a href= {% url 'inventory' %} &gt;Truck Inventory&lt;/a&gt;&lt;/li&gt;
  
  
  
     59 :                   &lt;li&gt;&lt;a href="#"&gt;Budget &lt;/a&gt;&lt;/li&gt;
  
  
  
     60 :                 &lt;/ul&gt;
  
  
  
     61 :               &lt;/li&gt;
  
  
  
     62 :                
  
  
  
     63 :               {%else %}
  
  
  
     64 :               &lt;li&gt;&lt;a href="login"&gt;Login&lt;/a&gt;&lt;/li&gt;
  
  
  
     65 :               &lt;li&gt;&lt;a href="#"&gt;Contact&lt;/a&gt;&lt;/li&gt;
  
  
  
     66 :               &lt;li&gt;&lt;a href="#"&gt;Join us&lt;/a&gt;&lt;/li&gt;
  
  
  
     67 :               {% endif %}
  
  
  
     68 :               &lt;li&gt;&lt;a href="#"&gt;Resources&lt;/a&gt;
  
  
  Traceback:
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
    132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/bioluminati/camp/views.py" in inventory
    182.     return render(request, 'inventory.html', {'form': form, 'stuff': stuff})
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/shortcuts.py" in render
    67.             template_name, context, request=request, using=using)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
    99.         return template.render(context, request)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/backends/django.py" in render
    74.         return self.template.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in render
    209.                     return self._render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in _render
    201.         return self.nodelist.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in render
    903.                 bit = self.render_node(node, context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/debug.py" in render_node
    79.             return node.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/loader_tags.py" in render
    135.         return compiled_parent._render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in _render
    201.         return self.nodelist.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in render
    903.                 bit = self.render_node(node, context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/debug.py" in render_node
    79.             return node.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    329.                 return nodelist.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/base.py" in render
    903.                 bit = self.render_node(node, context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/debug.py" in render_node
    79.             return node.render(context)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    507.                         six.reraise(*exc_info)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/template/defaulttags.py" in render
    493.             url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/core/urlresolvers.py" in reverse
    579.     return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs)))
  File "/Users/rebeccaeliserobbins/Documents/repos/djangoBurnApp/env/lib/python2.7/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
    496.                              (lookup_view_s, args, kwargs, len(patterns), patterns))
  
  Exception Type: NoReverseMatch at /inventory/16/
  Exception Value: Reverse for 'inventory' with arguments '()' and keyword arguments '{}' not found. 1 pattern(s) tried: ['inventory/(?P&lt;id&gt;\\d+)/$'
  </code></pre>
  
  <p>]</p>