Giter VIP home page Giter VIP logo

django-star-ratings's People

Contributors

4lm avatar amiraref avatar anex avatar bee-keeper avatar darkdemiurg avatar dependabot[bot] avatar dlrsp-dev avatar fuzzpedal avatar gday avatar jamesoutterside avatar jdwpeterson avatar jneves avatar juanmanatal avatar luizomf avatar marcanuy avatar marcwebbie avatar mvillalba avatar nix1947 avatar omegadroid avatar rabidcicada avatar radiac avatar rolo avatar stuartmackay avatar urtzai avatar virtualanup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-star-ratings's Issues

unvote voted object

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?

how can I import?

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.

Can't install on Windows

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.

Display "rating average" on other pages

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!

STAR_RATINGS_RERATE = False does not work

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!

Rating max value

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.

Remove total rating

keeping the total rating is redundant, instead we should only keep the average rating and the number of ratings

Reduce admin queries

The str method on both AggregateRating and Rating is resulting in an additional query per row.

Different ratings on same page?

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?

using Django CSRF

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?

Order by rate

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

To GET or POST: that is the question

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?

Users cannot vote again

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.

image

Also when I opened the developer tools I saw errors whenever I try to rerate the book

image

image

What seem to be the problem? I have followed the installation steps properly

After start rate click, screen goes blank

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 ?

Pass the template name as a parameter

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:

  1. Template tag arg
  2. Context variable
  3. Default site wide template

star icons not scaling to args size

Rating stars not scaling with width and height args set in template tags.
<span class="pull-right">{% ratings obj 20 20 %}</span>

I'm using bootstrap 3 for the frontend Here is my result, is this a bug?
e333

Standardise test runner script names

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.

IP address from request.META.get('REMOTE_ADDR') issue

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

Cannot rate: Please log in to rate.

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?

Python 2.7 Unicode Issue ('ascii' codec can't decode byte 0xc5 in position 6: ordinal not in range(128))

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.

invalid literal for int() with base 10: 'Eid Offer at Amari Dhaka'

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.

Remove the info under the stars

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

Can't display stars by themselves. Can't access the average ratings as integers in order to use the data.

Using a blog as an example.

1. Say I wanted to take all of the average ratings of articles by a particular user, and give them an average rating based off of that? This may already be possible after digging into source code for a bit, however that may be an important feature to include right out of the box with documentation.

2. I think there should be a way for us to access each part of the rating display as well individually. For instance on the preview, you may want to only show the stars, and not the rest of the details about the ratings.

3. There should be a way to state whether or not the stars are for display or if you can set a rating in a particular view. For instance in a preview you'd want to see the stars however you shouldn't be able to rate until you've opened the article.

Installation error

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

Problem with Js "onmouseenter" with different star icon size?

I've tried it on Firefox and Chrome:


screenshot from 2015-11-06 08 48 51


screenshot from 2015-11-06 08 50 40


screenshot from 2015-11-06 08 51 06


screenshot from 2015-11-06 08 51 26


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)

[SOLVED] 'str' object has no attribute '_meta'

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 :

Screenshot :
error

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

"ImportError: No module named star_ratings" with Python 2.7

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.