Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added optional feedback text & fix url #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pinax/ratings/migrations/0004_rating_feedback.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.0.3 on 2022-04-07 03:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('ratings', '0003_auto_20170819_1127'),
]

operations = [
migrations.AddField(
model_name='rating',
name='feedback',
field=models.TextField(blank=True, default=''),
),
]
1 change: 1 addition & 0 deletions pinax/ratings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Rating(models.Model):
content_object = GenericForeignKey()
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
rating = models.IntegerField()
feedback = models.TextField(blank=True, default="")
timestamp = models.DateTimeField(default=timezone.now)
category = models.CharField(max_length=250, blank=True, choices=RATING_CATEGORY_CHOICES)

Expand Down
3 changes: 2 additions & 1 deletion pinax/ratings/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def setUp(self):
content_type=ContentType.objects.get_for_model(self.expedition),
user=self.paltman,
category=self.speed,
rating=5
rating=5,
feedback="Ford expedition is very good!"
)
self.overall_rating_object = OverallRating.objects.create(
object_id=self.expedition.pk,
Expand Down
7 changes: 6 additions & 1 deletion pinax/ratings/tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from django.conf.urls import include, url
try:
from django.conf.urls import url
except ImportError:
from django.urls import re_path as url

from django.conf.urls import include

urlpatterns = [
url(r"^", include("pinax.ratings.urls", namespace="pinax_ratings")),
Expand Down
5 changes: 4 additions & 1 deletion pinax/ratings/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from django.conf.urls import url
try:
from django.conf.urls import url
except ImportError: # pragma: no cover
from django.urls import re_path as url # pragma: no cover

from pinax.ratings import views

Expand Down