Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango NoReverseMatch at /display/
    primarykey
    data
    text
    <p>I'm working on a simple app where pet users can create boards about their pets and display pictures on the boards.</p> <p>I'm trying to create a feature where users can click on their boards which will redirect them into their boards which will display all their pets pictures .</p> <p><img src="https://i.stack.imgur.com/81TG4.jpg" alt="enter image description here"></p> <p><em>I get an error when I try to configure my template to redirect the users to their boards.</em></p> <pre><code>Reverse for 'Boat' with arguments '('',)' and keyword arguments '{}' not found. Django Version: 1.4.3 Exception Type: NoReverseMatch Exception Value: Reverse for 'Boat' with arguments '('',)' and keyword arguments '{}' not found. Error during template rendering In template C:\o\mysite\pet\templates\edit.html, error at line 14 13 {% for b in board %} 14 &lt;li&gt;&lt;a href ="{% url world:Boat animal.id %}"&gt;{{ b.name }}&lt;/li&gt; </code></pre> <p><img src="https://i.stack.imgur.com/Vr7SE.jpg" alt="enter image description here"></p> <p><em>I think problem is right here When the user clicks on a board . My URLconf will capture the animal.id and pass it into my Boat function but I'm not sure what went wrong</em></p> <pre><code>&lt;li&gt;&lt;a href ="{% url world:Boat animal.id %}"&gt;{{ b.name }}&lt;/li&gt; </code></pre> <p><strong>My edit.html</strong></p> <pre><code>&lt;h4&gt;My Boards&lt;/h4&gt; {% if board %} &lt;ul&gt; {% for b in board %} &lt;li&gt;&lt;a href ="{% url world:Boat animal.id %}"&gt;{{ b.name }}&lt;/li&gt; {% endfor %} &lt;/ul&gt; {% endif %} </code></pre> <p><strong>My Main URLconf</strong></p> <pre><code>urlpatterns = patterns('', url( r'^admin/', include(admin.site.urls) ), url( r'^', include('pet.urls', namespace = 'world') ), </code></pre> <p><strong>Parts of my Pet app URLconf</strong></p> <pre><code>url( r'^(?P&lt;animal_id&gt;\d+)/$', 'pet.views.Boat', name = 'Boat', ), </code></pre> <p><strong>My parts of my views.py</strong></p> <pre><code>def Profile(request): if not request.user.is_authenticated(): return HttpResponseRedirect(reverse('world:LoginRequest')) if request.method == 'POST': form = PersonForm(request.POST, request.FILES) if form.is_valid(): person = Person.objects.get(user=request.user) person.image = form.cleaned_data['image'] person.name = form.cleaned_data['name'] person.save() return render(request,'profile.html',{'form': PersonForm()}) def Boat(request ,animal_id): if not request.user.is_authenticated(): return HttpResponseRedirect(reverse('world:LoginRequest')) picture = Picture.objects.filter(board=animal_id) return render(request,'boat.html',{'picture':picture}) </code></pre> <p>Thank you for helping me :]</p> <p>My more of my views.py </p> <pre><code>def Display(request): if not request.user.is_authenticated(): return HttpResponseRedirect(reverse('world:LoginRequest')) board = Board.objects.filter(user=request.user) person = Person.objects.get(user=request.user) return render(request,'edit.html',{'board':board ,'person':person}) </code></pre> <p>My models.py</p> <pre><code>class Person(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=100) image = models.FileField(upload_to="images/",blank=True,null=True) following = models.ManyToManyField('self', related_name='followers', symmetrical=False, blank=True, null=True) def __unicode__(self): return self.name class Board(models.Model): user = models.ForeignKey(User) name = models.CharField(max_length=100) def __unicode__(self): return self.name </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload