wildfish / django-star-ratings Goto Github PK
View Code? Open in Web Editor NEWStar ratings for your Django models with a single template tag. Python 3 compatible.
License: Other
Star ratings for your Django models with a single template tag. Python 3 compatible.
License: Other
This is a great app, One thing I'm having trouble with is if I vote 3 stars and then vote 3 stars again is it possible to unvote and uncount the voted object?
I'm a newbie here, but when I chain .order_by('ratings__average') on my filter, it sorts from lowest rated to highest rated. Is this a bug? if not, how can I reverse the sort order?
Hard to see what the rating is for in the admin currently.
I am trying to add the field to my model, but, I didn't find the correct way to import.
when i try
ratings = GenericRelation(Rating, related_query_name='foos')
obviously receive a "NameError: name 'Rating' is not defined".
But I cant find any doc to do the correct import.
Really thanks.
I get the following error after running pip install django-star-ratings
:
WindowsError: [Error 206] The filename or extension is too long: 'c:\\users\\<user>\\appdata\\local\\temp\\pip-1omakv-build\\star_ratings/static/star-ratings/js/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/node_modules/minimalistic-assert/'
There are a number of folders/files that are too long.
I'm trying to display the star staring on other webpage (in addition to the page where the user can actually vote and change the rating).
My model is:
class Article(models.Model):
...
rate = GenericRelation(Rating, related_query_name='articles')
Then, I'm trying to get the rating average for my object article
in my template with:
{{ article.rate.average }}
I've tried also:
{{ article.rate.rating.average }}
But the field is still blank. How can I access some fields inside the ratings models? Thanks a lot in advance!
I'm having problem with the rerate.
I set STAR_RATINGS_RERATE=False and STAR_RATINGS_ANONYMOUS = True, but it still let me rerate the object as anonymous.
I'm not sure if log in user will work because my website does not need user log in.
I'm new to python and Django, not sure where I did wrong, any help is appreciated!
Currently the max value of a rating is being stored on a per object basis. This logic is flawed as it is very unlikely a user would want diferent objects of the same type to have different rating scales. Instead we should store it by content type.
A nice way to solve this is by defining the max_value by model name in the settings file, when an AggregateRating object is created the current max will be stored in it. We can then create a manage command to rescale ratings that would find all ratings that don't match the current max_value and rescale their values.
If the max value is not specified for a model the STAR_RATINGS_RANGE
should define the range.
Created from #79 point 3. This should the have following precedence:
I suspect we can just create a custom bulk_create in the manager.
How Do I Use this app with jinja2 Tempalte??
How can I do that?
Like {% load ratings %} doesn't exist in jinja2
keeping the total rating is redundant, instead we should only keep the average rating and the number of ratings
The str method on both AggregateRating
and Rating
is resulting in an additional query per row.
I'm not sure if this is the correct place to ask, but is there any way to have ratings from multiple different users on the same page?
I've been having issues with CSRF on Django1.9 (Forbidden CSRF token missing or incorrect.): /ratings/...
What would be the best way to securely submit a rating using the Django CSRF?
Dears,
Can I order by rating?
I would like to order a queryset by rating, my model is very simple:
class Exercise(models.Model):
author = models.ForeignKey('auth.User')
title = models.CharField(max_length=200)
text = models.TextField()
created_date = models.DateTimeField(default=timezone.now)
ratings = GenericRelation(Rating, related_query_name='difficulty')
thanks in advance
Now 1.9's at RC ensure things work with it.
Hello
Clicking on on a star, i get 405 method not allowed
i checked the source and found that the Rate
view only has a post
method, but the rate submission is done via a simple href
tag. how could this be possible?
Django version: 1.10.1
Python: 2.7
Browser: UC Browser and Google Chrome.
STAR_RATINGS_RERATE = True
Problem: User can give a rating if the object being rated (i.e. book) is not yet in the userRating and Rating models. The problem is that whenever I try to reload the page and rerate again in the console it says matching query does not exists.
Also when I opened the developer tools I saw errors whenever I try to rerate the book
What seem to be the problem? I have followed the installation steps properly
All seem to be fine, but after I click the star rating, the browser goes blank - nothing shown. But in the browser url there looks like below
domain.com/ratings/82/26/?return=/zh-hans/tut3/cook/26/
And nothing happens...
What am I missing ?
It will probably be useful to change the template being used on a case by case basis rather than only being able to control it by overriding star_rating/widget.html
. This should probably allow the template name to be set in the context or as a template tag arg with the following precedence:
We have:
runtests.sh
runwithcoverage.sh
run_selenium_tests.sh
They need naming into something consistent. Seems a bit untidy having these all hanging around in the root to me too. Would be interested to see what other projects do when they have multiple ones of these.
I came accross this error:
DataError at /ratings/18/3/ invalid input syntax for type inet: "b''"
After googling and i found the problem:
ip = self.request.META.get('REMOTE_ADDR') - this line in views.py gets the ip only from REMOTE_ADDR, however it should get it also from HTTP_X_REAL_IP, as described in http://stackoverflow.com/questions/34238623/invalid-input-syntax-for-type-inet-db-error-in-django-app-with-postgres-and-gu
Please look into this.
I will provide full logs/configs if needed, the setup is Django 1.10.3, Python 3.5.2, nginx 1.10.0, Postgresql 9.5
Does nothing when I touch on the stars. Shows this under the ratings: 'Please log in to rate.' My web app does not have any 'user'. Its open for all. How can I enable any one to rate?
Need to consider best course of action here.
From xerlivex on Reddit at https://www.reddit.com/r/django/comments/3l6nky/django_star_ratings_python_3_ratings_for_django/cyxqcu3:
Not sure if it's due to compatibility (I use python 2.7), but I ran into the following issue. I have a model related to Rating model by foreign key, but they have non ASCII characters in their names. When I try accessing the Ratings or UserRatings through django admin I get an error along the lines:
'ascii' codec can't decode byte 0xc5 in position 6: ordinal not in range(128)
the site works fine however. I came up with a work around by modifying the Rating and UserRating models I added "u" to```def __str__(self): return u'{}'.format(self.content_object)
and
def __str__(self): return u'{} rating {} for {}'.format(self.user, self.score, self.rating.content_object)
works for me. I can access both models through the admin. Is this a bug or is there a more reasonable workaround?
Thanks.
Hello.
In my template, I have a for loop that goes over 'deals' with each instance labelled as 'deal'. Therefore, I put {% ratings deal %}. Then I get this error: invalid literal for int() with base 10: 'Eid Offer at Amari Dhaka'
I see that its trying to convert the title of the deal to a rating. How do i solve this? Thank you.
Dears,
I would like remove all the info messages under the stars (Average, Rating Count, You Rated, Please log in to rate), because I have two django views. One view is about an abstract, and the other a more detailed. At the first I need show only the five stars.
Can I do that?
really thanks
When I type: pip install django-star-ratings, I get:
FileNotFoundError: [WinError 206] The filename or extension is too long: 'C:\Users\User\AppData\Local\Temp\pip-build-8_ynw5yv\django-star-ratings\star_ratings/static/star-ratings/js/node_modules/browserify/node_modules/crypto-browserify/node_modules/public-encrypt/node_modules/parse-asn1/node_modules/asn1.js/rfc/2560/test
I've tried it on Firefox and Chrome:
As you see:
When the user has not rated yet: The mouse over highlights the star wrongly with one more star on the right.
But the rating is good and fits where the mouse has clicked.
When the user has rated, if he mouses over again on the stars, the mouse over is right...
No problem if I use the original size of 32x32 (here, it's 16x16)
For performance.
Hi,
First, thank you for such a great work! I really need your plugin :)
But I have one issue with it. I'm sure I already following your instruction step-by-step, but still no good, please have a look :
This is my log :
"GET /accounts/zea/ HTTP/1.1" 500 187315
Did I miss something here? Maybe I should modified my models's too?
I'm using Django 1.8.7
Thank you in advance for any help you can provide :)
EDIT
SOLVED!
I change ratings object, to ratings profile (since my models is profile) on template
Thank you
Import error when using python manage.py makemigrations
I have the following in my app:
settings.py
INSTALLED_APPS = ( ... 'star_ratings', )
urls.py
urlpatterns = [ ... url(r'^ratings/', include('star_ratings.urls', namespace='ratings', app_name='ratings')), ]
requirements.txt django-star-ratings==0.2.1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.