I am creating a website where users can comment on photos in a gallery. The 
challenge I currently have is that Django is not able to determine which of the 
photos the comment 'submit' button relates to. 

This is my HTML code for the photo gallery:

        <h2>comments</h2>
                {% if not comments %}
                No comments
                {% endif %}
                {% for x in comment %}
                <div class="comments" style="padding: 10px;">
                    <p class="font-weight-bold">
                        <h4>Comment by</h4> {{ x.user }}
                        <span class=" text-muted font-weight-normal">
                            {{ x.created_on }}
                        </span>
                    </p>
                    {{ x.body | linebreaks }}
                </div>
                {% endfor %}
            </div>
            <div class="card-body">
                {% if new_comment %}
                <h2>Your comment has been posted.</h2>
                {% else %}
                <h3>Leave a comment</h3>
                <form action="{% url 'nowandthen:add_comment'%}" method="POST">
                    {{ comment_form.as_p }}
                    {% csrf_token %}
                    <button type="submit" class="btn btn-primary  
btn-lg">Submit</button>
                {% endif %}

How do you suggest I overcome this problem, please?

Thanks

Jeff

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cabe2b94-bf00-4394-b699-8a15d48247d2%40googlegroups.com.

Reply via email to