← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands-website/replace_djangoratings into lp:widelands-website

 

The proposal to merge lp:~widelands-dev/widelands-website/replace_djangoratings into lp:widelands-website has been updated.

Description changed to:

Another cleanup for the update of python. Exchange the old unmaintained app djangoratings with an up-to-date app.

I decided to get this in in two steps:

1. This branch adds the new app. The conversion of old votes to new votes can be done in the django shell (see below). In this branch the old values remains visible, so we can check if the conversion is done correctly.

2. In a another branch we clean up the code to remove the old app djangorating.

After merging this branch it is important to delete a remaining .pyc file:

djangoratings/templatetags/ratings.pyc

We can import the old ratings as follows in the django shell:

from djangoratings.models import Score, Vote
from star_ratings.models import Rating, UserRating

for obj in Score.objects.all():
   vote_obj = Rating.objects.create(object_id=obj.object_id, content_type=obj.content_type)
   for v in Vote.objects.filter(object_id=obj.object_id, content_type=obj.content_type):
      vote = UserRating.objects.create(user=v.user, ip=v.ip_address, score=v.score, rating=vote_obj)
      vote.save()
   vote_obj.calculate()

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands-website/replace_djangoratings/+merge/358958
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands-website/replace_djangoratings into lp:widelands-website.


References