django-updown
django-updown is a simple Django application for adding youtube like up and down voting.
Usage
Add "updown" to your INSTALLED_APPS then just add a RatingField to your model and go:
from django.db import models from updown.fields import RatingField class Video(models.Model): rating = RatingField()
You can also allow the user to change his vote:
class Video(models.Model): rating = RatingField(can_change_vote=True)
Now you can write your own view to submit ratings or use the predefinded:
from updown.views import AddRatingFromModel
urlpatterns = patterns("",
url(r"^(?P<object_id>\d+)/rate/(?P<score>[\d\-]+)$", AddRatingFromModel(), {
'app_label': 'video',
'model': 'Video',
'field_name': 'rating',
}, name="video_rating"),
)
To submit a vote just go to video/<id>/rate/(1|-1). If you allowed users to change they’re vote, they can do it with the same url.
Thanks
Thanks a lot to django-ratings for the inspiring code
Metadata
Release files for django-updown 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-updown-0.0.3.tar.gz | 6.3 kB | Without provenance | Details for django-updown-0.0.3.tar.gz |
Release files / django-updown-0.0.3.tar.gz
| Download URL | django-updown-0.0.3.tar.gz |
|---|---|
| Size | 6.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb6e7537ab16df7785e49b9f1f20353bb3ac996414b94bc901146c519c6b259c
|
|
BLAKE2b-256 checksum How to use checksums |
abac0ca98d295a4e4f4d42efc0ef470e342fd737d74d1359990490734e55c55b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-updown 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.