Thank you for your reply
I did that again I am getting this error
___________________________________________________________ TestViews.test_product_detail_authenticated ____________________________________________________________
klass = <class 'pages.models.vk_ls_product_search'>, args = (), kwargs = {'pk': 22}, queryset = <QuerySet [<vk_ls_product_search: QdlRuBGaIUoUrxhrJWzM>]>
def get_object_or_404(klass, *args, **kwargs):
"""
Use get() to return an object, or raise a Http404 exception if the object
does not exist.
klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword arguments are used in the get() query.
Like with QuerySet.get(), MultipleObjectsReturned is raised if more than
one object is found.
"""
queryset = _get_queryset(klass)
if not hasattr(queryset, 'get'):
klass__name = klass.__name__ if isinstance(klass, type) else klass.__class__.__name__
raise ValueError(
"First argument to get_object_or_404() must be a Model, Manager, "
"or QuerySet, not '%s'." % klass__name
)
try:
> return queryset.get(*args, **kwargs)
c:\users\user\appdata\local\programs\python\python38\lib\site-packages\django\shortcuts.py:76:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <QuerySet [<vk_ls_product_search: QdlRuBGaIUoUrxhrJWzM>]>, args = (), kwargs = {'pk': 22}, clone = <QuerySet []>, limit = 21, num = 0
def get(self, *args, **kwargs):
"""
Perform the query and return a single object matching the given
keyword arguments.
"""
clone = self._chain() if self.query.combinator else self.filter(*args, **kwargs)
if self.query.can_filter() and not self.query.distinct_fields:
clone = clone.order_by()
limit = None
if not clone.query.select_for_update or connections[clone.db].features.supports_select_for_update_with_limit:
limit = MAX_GET_RESULTS
clone.query.set_limits(high=limit)
num = len(clone)
if num == 1:
return clone._result_cache[0]
if not num:
> raise self.model.DoesNotExist(
"%s matching query does not exist." %
self.model._meta.object_name
)
E pages.models.vk_ls_product_search.DoesNotExist: vk_ls_product_search matching query does not exist.
c:\users\user\appdata\local\programs\python\python38\lib\site-packages\django\db\models\query.py:415: DoesNotExist
During handling of the above exception, another exception occurred:
self = <test_views.TestViews object at 0x0000003BBE75DA00>
def test_product_detail_authenticated(self):
mixer.blend('pages.vk_ls_product_search')
path = reverse('ProductDetails_ls', kwargs={'pk': 22})
> response = onClickSearch.ProductDetails_ls(request, pk=22)
pages\tests\test_views.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages\views.py:2795: in ProductDetails_ls
product_ls = get_object_or_404(vk_ls_product_search, pk=pk)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
klass = <class 'pages.models.vk_ls_product_search'>, args = (), kwargs = {'pk': 22}, queryset = <QuerySet [<vk_ls_product_search: QdlRuBGaIUoUrxhrJWzM>]>
def get_object_or_404(klass, *args, **kwargs):
"""
Use get() to return an object, or raise a Http404 exception if the object
does not exist.
klass may be a Model, Manager, or QuerySet object. All other passed
arguments and keyword arguments are used in the get() query.
Like with QuerySet.get(), MultipleObjectsReturned is raised if more than
one object is found.
"""
queryset = _get_queryset(klass)
if not hasattr(queryset, 'get'):
klass__name = klass.__name__ if isinstance(klass, type) else klass.__class__.__name__
raise ValueError(
"First argument to get_object_or_404() must be a Model, Manager, "
"or QuerySet, not '%s'." % klass__name
)
try:
return queryset.get(*args, **kwargs)
except queryset.model.DoesNotExist:
> raise Http404('No %s matches the given query.' % queryset.model._meta.object_name)
E django.http.response.Http404: No vk_ls_product_search matches the given query.
c:\users\user\appdata\local\programs\python\python38\lib\site-packages\django\shortcuts.py:78: Http404
Please can you help me to solve this error too , Thank you