bitlabstudio / django-review Goto Github PK
View Code? Open in Web Editor NEWA reusable Django app that lets users write reviews for any model
License: MIT License
A reusable Django app that lets users write reviews for any model
License: MIT License
https://github.com/bitlabstudio/django-review/blob/master/review/templatetags/review_tags.py#L50 throws the AttributeError'bool' object has no attribute 'items'
because https://github.com/bitlabstudio/django-review/blob/master/review/models.py#L158 does indeed return a bool instead of a dict
The attribute base_manager_name was introduced in Django 1.10.
There is a necessity to specify a minimal supported version in setup.py.
The exception happened during ./manage.py migrate
.
My Django version is 1.8.9.
Does this app support API services
While adding the code : url(r'^review/$', include('review.urls')) into urls.py, its throwing import error
I am using Django-Edge. (django-edge.readthedocs.io/)
Logs:
http://pastebin.com/PV3xKtpH
Hello,
Am currently facing a problem which didn't exist before. When someone makes a review without ratings, a default value is set as rating values. Depending on how my SELECTION options(HTML) is set, the default value could be a 1 or 5. What might be causing this. In the past, when there is no rating by a user, it saves nothing. Help needed, thanks.
Just to let you know that this is listed as not being Python 3 compatible in https://djangopackages.org/packages/p/django-review/
The repo URL is https://github.com/bitmazk/django-review which redirect to this package
I am using django-review package with one of my application where i am using the custom user model for Authentication. I have installed the django-review in my virtual environment and added the review app in my Installed_APPS as it is described in the documents of package.
but when i am running ./manage.py migrate review i am getting an error that django.db.utils.ProgrammingError: relation "review_review" does not exist
i did everythin same as it is defined in django-review package documents.
Hi, am still able to make a review for some objects (not all though) despite having REVIEW_AVOID_MULTIPLE_REVIEWS = True. What could be wrong? Thanks
I modified most part (on_delete argument) and so on but could not get my head around django.utils.functional.curry. I could not even find anything about it on google. I actually can write the 3.0 patch myself and make PR if someone provides me information about curry.
I am considering adding a subject field to the data object of the review. It is fairly common on most sites to have a single line subject to represent the overall sentiment of the review. Amazon is the king in this department.
Also it would correlate to the schema that is the standard for representing reviews:
The field is "name" which is inherited from Thing object.
http://schema.org/Review
This effects SEO. What I do now is fill that field with N characters snippet from the review body.
Hello.
I created the review url as specified in the README.
When I click on the URL, the url shows up fine, but there is no form to review the item.
Should I link to my custom form? or is there any form already available?
Please let me know.
Regards.
Hi!
How would one go about creating a manual approval barrier for ratings and reviews?
Thanks!
New generic install from both PyPi and Github result in an error when running
python manage.py runserver
:
`
File "/home/bandman/code/findscience/env/lib/python3.6/site-packages/review/models.py", line 22, in
class Review(models.Model):
File "/home/bandman/code/findscience/env/lib/python3.6/site-packages/review/models.py", line 42, in Review
content_type = models.ForeignKey(ContentType)
TypeError: init() missing 1 required positional argument: 'on_delete'
`
The docs describe a tag that renders categories, and I can see them being handled in the code, but I haven't got my head around what they are or how you are intended to set them up.
Would be good to include this info in the doc.
base.html
Request Method: GET
Request URL: http://127.0.0.1:8000/review/store/1/create/
Django Version: 1.11.1
Exception Type: TemplateDoesNotExist
Exception Value:
base.html
Python Version: 3.6.1
Hi there,
I am trying to use your app in my web app. I followed your instruction. When I go to /id/create, the form doesnt display, all is blank. Any ideas?
I need to show a default value of 7 on 10 for my model, is there a way i can set it to show 7 instead of 0
Hello.
I started using the review averages tag {% render_category_averages book 100 %}
but whenever I use it, it just gives Amount of reviews: 1 and nothing else. I'm tackling with it currently and will write here if I find out why. Is anyone else having the same problem ?
Thanks !
Hello !
Is it possible to make average score use dot to separate like 5.7 instead of 5,7 ?
Thanks
I am using the latest version of django review. I successfully added reviews to the database. But when I tried to delete on or more tables, it resulted in attribute error. The complete traceback is given below:
I tried to install your module, but when I run ./manage.py migrate review I get the error saying "ImportError: cannot import name CHUNK_SIZE"
Please let me know if that is a known issue, and if there is any solution.
Regards.
Was trying render_category_averages tag as provided in guide. Gave me that error. Can anyone recreate that problem ? Thanks !
It doesn't pass the reviewed_item object.
This is my page
{% load i18n %}
{% load review_tags %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
{% block main %}
<a href="{% url "review_create" content_type='book' object_id=book.pk %}">{% trans "Review this book" %}
{% render_category_averages object 100 %}
{% endblock %}
</body>
</html>
What am I doing wrong now ? Should I pass an object ? Why so ?
Thanks !
use select_related on a translated model, you must provide a list of fields.
When I try to visit the "Rating category choices" in admin, get this message.
Do i miss any thing?
Hello
I'm getting the following error when running migrate, after adding 'review' to installed apps sections in settings.py
"Migration %s dependencies reference nonexistent parent node %r" % (migration, parent)
KeyError: u"Migration review.0001_initial dependencies reference nonexistent parent node (u'contenttypes', u'0002_remove_content_type_name')"
Here is a full stack trace for the error
http://pastebin.com/raw/x000GZne
Thank you
Please what is the best way to customize the review templates? Working on the original templates in the review app or creating new templates in my app. If it's the latter, how should this be done? Thanks
Hi !
I was experimenting with <a href='{% url "review_create" content_type=book object_id=id %}'>{% trans "Review this book" %}</a>
I realized when I register my book object with object id 1 and when it gets a PK from python id, instead of using object_id, I need to use that pk. Is that a bug or feature ? Because when I look at object_id tag, I think about ContentType relations and want to fill that tag with object_id.
Summary :
Book object created with object_id, positive integer field = 2
Python assigned PK 1 to Book object
Tag asks me to put object_id, I pass 2, doesn't work
Tag asks me to put object_id, I pass 1(PK), works
Did I misunderstood the concept or is this a feature ➿
I could set object_id class as PK but I'm not really fan of it.
Thanks !
please update for django 1.9
use this
from django.contrib.contenttypes import fields
instead offrom django.contrib.contenttypes import generic
I've an installation of this where the review_create
route responds with:
content-type: {model-name}
It seems that this property you set here https://github.com/bitlabstudio/django-review/blob/master/review/views.py#L83, self.content_type
, which ends-up being used here: https://github.com/django/django/blob/master/django/views/generic/base.py#L120 to set the content-type to the repr of something (?).
I'm a beginner with Django, just would like to understand how to make content-type
be html.
Can we get template tags for the extra content type just like we have for content type so I can use the same review on 2 objects easily without having to add fields to their models. I would do the tags myself, but my dev machine has all kinds of weird environment issues and I can't :(
Any questions just let me know. Thank you for your great app :D
I apologize if this isn't the right place but I thought I'm definitely not the only one that faced this issue so this might also help others.
I just installed django-review and I'm still learning how to use it but I get this error:
hvad.descriptors.NoTranslationError
when I try to create a new review for my Post
model.
I don't have, and probably won't need, translation support for my app.
I am running django 2.0, i googled and got this page [(https://stackoverflow.com/questions/21021690/python-django-custom-template-tags-register-assignment-tag-not-working)] any idea to get it working?
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/auth/user/
Django Version: 1.6.5
Python Version: 2.7.5
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.sitemaps',
'users',
'venues',
'widget_tweaks',
'debug_toolbar',
'imagekit',
'taggit',
'south',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.facebook',
'allauth.socialaccount.providers.google',
'mptt',
'tagging',
'zinnia',
'django.contrib.comments',
'sortedm2m',
'easy_maps',
'hvad',
'review',
'autocomplete_light')
Installed Middleware:
(u'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/Users/siddharth/Documents/workspace/mac_env/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
return self.admin_site.admin_view(view)(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return view(request, _args, *_kwargs)
return bound_func(_args, *_kwargs)
response = view_func(request, _args, *_kwargs)
return func(self, _args2, *_kwargs2)
response = self.response_action(request, queryset=cl.get_queryset(request))
response = func(self, request, queryset)
queryset, opts, request.user, modeladmin.admin_site, using)
collector.collect(objs)
return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
field.rel.on_delete(self, field, sub_objs, self.using)
source_attr=field.name, nullable=field.null)
return super(NestedObjects, self).collect(objs, source_attr=source_attr, **kwargs)
sub_objs = field.bulk_related_objects(new_objs, self.using)
return self.rel.to._base_manager.db_manager(using).filter(**{
Exception Type: AttributeError at /admin/auth/user/
Exception Value: 'str' object has no attribute '_base_manager'
Currently, when I link users to create a review for an item, there is no backend enforcement to prevent users from creating multiple reviews for individual instances.
In this example, the user reviews a seller:
<a href="{% url 'review_create' content_type='seller' object_id=seller.pk %}">
Review seller
</a>
Customer is taken to the create page. Customer creates review.
In my code, the link to the create page is hidden after a review is created. However, if the user visits the page again, they are allowed to create another review, in addition to the previous one. This could be disabled by adding a permission function disabling this. But on the database level, there is no requirement for uniqueness in the Database Table (someone can add another review in the shell, admin, etc).
This sounds like undesirable behavior. I'm working on a solution to this and will open a PR soon.
There are some issues while deleting the reviews for an object in django-admin. I added some reviews to an object but got errors while deleting the reviews from admin-site.
This is the traceback.
Traceback (most recent call last):
File "/home/user/task/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, _callback_args, *_callback_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 432, in wrapper
return self.admin_site.admin_view(view)(_args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, _args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/views/decorators/cache.py", line 52, in _wrapped_view_func
response = view_func(request, _args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/sites.py", line 198, in inner
return view(request, _args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 29, in _wrapper
return bound_func(_args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, _args, *_kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in bound_func
return func(self, _args2, *_kwargs2)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1331, in changelist_view
response = self.response_action(request, queryset=cl.get_queryset(request))
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/options.py", line 1084, in response_action
response = func(self, request, queryset)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/actions.py", line 36, in delete_selected
queryset, opts, request.user, modeladmin.admin_site, using)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 109, in get_deleted_objects
collector.collect(objs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/admin/util.py", line 160, in collect
return super(NestedObjects, self).collect(objs, source_attr=source_attr, kwargs)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/db/models/deletion.py", line 201, in collect
sub_objs = field.bulk_related_objects(new_objs, self.using)
File "/home/user/task/env/local/lib/python2.7/site-packages/django/contrib/contenttypes/generic.py", line 239, in bulk_related_objects
return self.rel.to._base_manager.db_manager(using).filter({
AttributeError: 'str' object has no attribute '_base_manager'
[07/Oct/2014 07:57:20] "POST /admin/review/review/ HTTP/1.1" 500 217586
AttributeError at /admin/review/review/
'str' object has no attribute '_base_manager'
I am trying to build a templatetag to generate the review form on any page (instead of having to go to /review/ to fill the form) : any pointer about how to get this done ?
Ratings are not appearing in my templates, i can only see the review box. how can i solve this?
Hello, I have successfully being using django-review for months now. I want to move on to build APIs using the Django-review models. What's the best way I should go about it? Would appreciate some help. Thanks
Hi, it seems we can get averages, but not the individual ratings? I have a category called rating, and with it the user adds the review, and I can view the review and averages in the template but not the rating the user chose. How do I go about displaying this?
File "/usr/local/lib/python3.7/site-packages/review/models.py", line 22, in
class Review(models.Model):
File "/usr/local/lib/python3.7/site-packages/review/models.py", line 42, in Review
content_type = models.ForeignKey(ContentType)
TypeError: init() missing 1 required positional argument: 'on_delete'
Reverse for 'review_create' with arguments '()' and keyword arguments '{'content_type': 'blabla', 'object_id': ''}' not found. 1 pattern(s) tried: ['review/(?P<content_type>[-\w]+)/(?P<object_id>\d+)/create/$']
What should I do ?
Thank you !
Sorry for bothering but please is there a way of retrieving all reviews for a particular object? If I must do it by myself any guidelines? Thanks
Hello,
Please excuse me if this is the wrong place to post the issue .
I have installed django-review app. Using DRF for my project and so have written serializers to fetch Rating/Review/RatingCategory objects. I have written a custom model for which I get migration error on ./manage.py makemigrations:
You are trying to change the nullable field 'master' on ratingcategorytranslation to non-nullable without a default; we can't do that (the database needs something to populate existing rows).
Do you know what is the cause of the error? I'm using the default rating category choices.
Many Thanks,
Deepa
I've been looking round for a really good review app for django! Huzzah I found one.
But it's not compatible with python3.
Are there any plans to upgrade django-review to python3?
Hi, I get this error: 'str' object has no attribute '_base_manager' when i want to delete a review. What could be wrong? Thanks.
HI again. A couple of issues with the documentation:
It says that to use radio buttons instead of the select field, you add
REVIEW_FORM_CHOICES_WIDGET to the settings. This didn't work for me, and I couldn't even find it in the code until I found out it was defined as REVIEW_FORM_CHOICE_WIDGET.
Problem with this was that it didn't work either, the field completely disappeared. The ReviewForm has this and even when I supplied self.widget directly (as forms.RadioSelect) it didn't work.
for category in RatingCategory.objects.all():
field_name = 'category_{0}'.format(category.pk)
choices = category.get_choices()
self.fields[field_name] = forms.ChoiceField(
choices=choices, label=category.name,
help_text=category.question,
)
self.fields[field_name].required = category.required
if self.widget is not None:
self.fields[field_name].widget = self.widget()
I had to override the form and add the widget like so:
for category in RatingCategory.objects.all():
field_name = 'category_{0}'.format(category.pk)
choices = category.get_choices()
self.fields[field_name] = forms.ChoiceField(
choices=choices, label=category.name,
help_text=category.question,
widget=forms.RadioSelect(attrs={'class': 'star'})
)
Not sure if I went wrong somewhere or if this is a bug.
I included django-review in my project, I did all steps from docs, and I got this
(review)olexandr@vbox:~/projects/review_reboot$ python manage.py migrate review
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/management/init.py", line 385, in execute_from_command_line
utility.execute()
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/management/init.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(_args, *_options.dict)
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/management/base.py", line 337, in execute
self.check()
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/management/base.py", line 371, in check
all_issues = checks.run_checks(app_configs=app_configs, tags=tags)
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 59, in run_checks
new_errors = check(app_configs=app_configs)
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/core/checks/model_checks.py", line 28, in check_all_models
errors.extend(model.check(**kwargs))
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/db/models/base.py", line 1056, in check
errors.extend(cls._check_ordering())
File "/home/olexandr/.virtualenvs/review/local/lib/python2.7/site-packages/django/db/models/base.py", line 1398, in _check_ordering
cls._meta.get_field(field_name, many_to_many=False)
TypeError: call() got an unexpected keyword argument 'many_to_many'
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.