django-star-ratings icon indicating copy to clipboard operation
django-star-ratings copied to clipboard

'str' object has no attribute '_meta'

Open samich80 opened this issue 3 years ago • 9 comments

when i add {% ratings object %} in template, i get the error:

Exception Value: 'str' object has no attribute '_meta' Exception Location: /usr/local/lib/python3.10/site-packages/django/contrib/contenttypes/models.py, line 27, in _get_opts

samich80 avatar Nov 13 '21 15:11 samich80

hi me too :( please help

s-ali-mi avatar Dec 04 '21 15:12 s-ali-mi

Hi @samich80 Can you provide some details of your setup, how your defining you model, version of python/Django etc. Cheers!

jamesoutterside avatar Dec 09 '21 15:12 jamesoutterside

Hi yes me too version of python: 3.9 version of django: 3

I used the same method to set up

please help

🙏🌹

s-ali-mi avatar Dec 12 '21 04:12 s-ali-mi

Hey @0250902109

Would you be able to drop a snipped of your view, i.e what object is that's being passed to the template.

Cheers.

jamesoutterside avatar Dec 13 '21 08:12 jamesoutterside

someone managed to fix this?

when adding the tag {% ratings object %} in the template, it throws this error

shavakano avatar May 11 '22 17:05 shavakano

Hi @shavakano, would you be able to give us a snippet of your view, the bit that's passing object into the template context?

At first glance we'd thought people might be passing in the wrong type of object, but given this keeps coming up it must either be a bug or gap in the documentation - but we can't recreate it ourselves here, so will need someone to share their code to dig into this any further.

radiac avatar May 12 '22 13:05 radiac

someone managed to fix this?

when adding the tag {% ratings object %} in the template, it throws this error

disable STAR_RATINGS_OBJECT_ID_PATTERN = '[a-z0-9]{32}'

and it'll fix the issue.

Asmedeus998 avatar Jun 24 '22 03:06 Asmedeus998

I found the solution. The issue is a documentation issue.

You are required to set the object parameter in the {% rating object %} on the template.

dastiv21 avatar Jul 06 '22 11:07 dastiv21

I have the smae issue and am wondering how you could have gone about it. I also wanted to extend my Ratings model, do i have to import AbstractBaseRating from star_rating and if so kindly guide

dnd9 avatar Dec 25 '22 10:12 dnd9