Есть ли способ передать строку id в django url?

Шаблон.html для всех рядов модели

Этот шаблон представляет собой таблицу для отображения всех данных моей модели, когда пользователь нажимает на одну строку тегtr. он должен направить их на представление строки для редактирования или обновления.

tr onclick="location.href='{% url 'quality_control_point_view' object.id %}'"

Когда этот object.id был int AutoField, он работал просто отлично, но когда я изменил свою модель так, чтобы первичным ключом было Charfield. ошибка продолжает появляться

            <form action="" method="post">
                {% csrf_token %}
                <table id="material_issued">
                        <tr >
                            <th>{% translate 'Reference' %}</th>
                            <th>{% translate 'Title' %}</th>
                            <th>{% translate 'Product' %}</th>
                            <th>{% translate 'Operation' %}</th>
                            <th>{% translate 'Control Per' %}</th>
                            <th>{% translate 'Type' %}</th>
                            <th>{% translate 'Team' %}</th>
                        </tr>
                {% for object in table %}
                        <tr onclick="location.href='{% url 'quality_control_point_view' object.id %}'">
                            <td>{{ object.id }}</td>
                            <td>{{ object.title }}</td>
                            <td>
                                {% if object.raw_product is not None %}
                                    {{ object.raw_product }}
                                {% elif object.spare_product is not None%}
                                    {{ object.spare_product }}
                                {% else %}
                                    {{ object.bom_product }}
                                {% endif %}
                            </td>
                            <td >{{ object.operation.capitalize }}</td>
                            <td>{{ object.control_per.capitalize }}</td>
                            <td>{{ object.type.capitalize}}</td>
                            <td>{{ object.team }}</td>
                        </tr>
                {% endfor %}
                        <input type="hidden" name="length" id="num" value="{{ table.count }}">
                    </table>
                </form>

Urls.py для конкретной строки

path('Quality/QualityControlPoint/<str:qcp_id>', views.QualityControlPointView.as_view(),

Urls.py для всех рядов модели

path('Quality/QualityControlPoint', views.AllQualityControlPointView.as_view(),name='all_quality_control_point'),

View.py для всех рядов модели

class AllQualityControlPointView(LoginRequiredMixin, TemplateView):
    template_name = 'all_quality_control_point.html'

    def get_context_data(self, **kwargs):
        context = super().get_context_data(**kwargs)
        context['table'] = QualityControlPoint.objects.all()
        my_filter = QualityControlPointFilter(self.request.GET, queryset=context['table'])
        context['table'] = my_filter.qs
        context['my_filter'] = my_filter
        return context

    def get(self,request, *args, **kwargs):
        context = self.get_context_data(**kwargs)
        return render(request, self.template_name, context)

View.py для выбранной строки

Ошибка

Reverse for 'quality_control_point_view' with arguments '('QCP/0001',)' not found. 2 pattern(s) tried: ['en/Quality/QualityControlPoint/(?P<qcp_id>[^/]+)\\Z', 'Quality/QualityControlPoint/(?P<qcp_id>[^/]+)\\Z']
Вернуться на верх