Django - reverse_lazy in DeleteView yields NoReverseMatch
<p>New to Django and html; I want to add the possibility to delete objects from the database.</p>

<p>When I get to the delete confirmation template and click "Confirm", the objects gets deleted but I get this error: </p>

<blockquote>
  <p>"Reverse for 'assets' with arguments '()' and keyword arguments '{}'
  not found. 0 pattern(s) tried: []"</p>
</blockquote>

<p>My DeleteView includes <code>success_url = reverse_lazy("assets")</code>.  I get no error if I change that to <code>success_url = "/appname/assets/"</code>, the user gets redirected to the assets list as wanted, but I'd rather not use a hard-coded url.</p>

<p>Relevant code:</p>

<p>Models:</p>

<pre><code>class Asset(models.Model):
    filename = models.CharField(max_length=250, default="")
    file_location = models.CharField(max_length=1000, default="")
    file_size = models.PositiveIntegerField(default=0, blank=True, null=True)
    file_md5 = models.CharField(max_length=32, default="", blank=True)
    project = models.ForeignKey(Project, blank=True, null=True)
    provider = models.ForeignKey(Provider)

    def get_absolute_url(self):
        return reverse("appname:asset_details", kwargs={"pk": self.pk})

    def __str__(self):
        return self.filename
</code></pre>

<p>Views:</p>

<pre><code>class AssetsView(generic.ListView):
    template_name = "assets.html"
    context_object_name = "assets_list"

    def get_queryset(self):
        return Asset.objects.all()

class AssetDetailsView(generic.DetailView):
    model = Asset
    template_name = "asset_details.html"

class AssetDelete(DeleteView):
    model = Asset
    success_url = reverse_lazy("assets")
</code></pre>

<p>Urls:</p>

<pre><code>#  /tams/assets/
    url(r'^assets/$', views.AssetsView.as_view(), name="assets"),

#  /tams/asset/1/
    url(r'^asset/(?P&lt;pk&gt;[0-9]+)/$', views.AssetDetailsView.as_view(), name="asset_details"),

#  /tams/asset/1/delete/
    url(r'^asset/(?P&lt;pk&gt;[0-9]+)/delete/$', views.AssetDelete.as_view(), name="asset_delete"),
</code></pre>

<p>Asset Delete Template:</p>

<pre><code>{% block body %}

    &lt;form action="" method="post"&gt;{% csrf_token %}
        &lt;p&gt;Are you sure you want to delete "{{ asset.filename }}"?&lt;/p&gt;
        &lt;input class="btn btn-link"
                       type="button" value="Cancel"
                       onclick="window.history.go(-1);"/&gt;
        &lt;input class="btn btn-danger" type="submit" value="Confirm"/&gt;
    &lt;/form&gt;

{% endblock %}
</code></pre>

<p>I'm using Django 1.9.8 with Python 3.5</p>