Comments (13)
@MAkcanca The object_id
argument is empty. Add the ID or PK of the object to be reviewed.
from django-review.
@MAkcanca The content_type
should really exist (the object ID also).
from django-review.
@MAkcanca Load the book into the template context and do something like this:
<a href="{% url "review_create" content_type='book' object_id=book.pk %}">{% trans "Review this book" %}
Do not hardcode IDs and stuff.
If you want to know how this app works, please take a look at the source code.
Please understand that this is an issue tracker for this re-usable app. If you're new to Django/Python please use a more proper channel for your questions. Thanks!
from django-review.
Ah, a wild mistake appeared. Fixed that but now it gives 404 error. Is it because of my object or ? How should I set my object up ? Or is it because urls.py ? ( I can provide that if you think so)
from django-review.
class Book(models.Model):
name = models.CharField(max_length=400)
description = models.TextField()
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
def __str__(self):
return (self.name)
This is my current class.
How should I set up my urls.py ? Really appreciated !
from django-review.
@MAkcanca Please check out the README and follow the guide: https://github.com/bitlabstudio/django-review/blob/master/README.rst
Let me know, if there are issues.
from django-review.
Well I followed the guide but there was only one step to create review. So I wanted to try it and made a template file like this
{% load i18n %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
{% block main %}
<a href="{% url "review_create" content_type='book' object_id=1 %}">{% trans "Review this book" %}</a>
{% endblock %}
</body>
</html>
Not sure what else can I do ? I may sound a little silly. Thanks for helping me through.
from django-review.
@MAkcanca Is there a book with an ID of 1
in the database?
from django-review.
Yes
id | name | description | content_type_id | object_id
----+-------------------+-------------+-----------------+-----------
2 | Test Book | test | 17 | 1
from django-review.
@MAkcanca :) First row -> ID -> 2.
from django-review.
It was 1, I then deleted the row and created one again. Tried with ID 2, still doesn't work and gives 404.
from django-review.
Thanks a lot again. Not hardcoding it and handling it with PK solved it.
from django-review.
@MAkcanca You're welcome :)
from django-review.
Related Issues (20)
- render_category_averages breaks on reviews without ratings
- Outdated on Django Packages HOT 3
- Migration error HOT 1
- Approve reviews before they are shown in list of reviews HOT 1
- hvad.descriptors.NoTranslationError When creating a new review HOT 1
- 'str' object has no attribute '_meta' HOT 10
- ObjectID vs ID ? HOT 1
- Amount of reviews HOT 1
- Subject Field addition HOT 3
- Dot instead of comma HOT 1
- Content-type header is wrong? HOT 2
- TemplateDoesNotExist at ~ HOT 1
- Rest APi
- TypeError: 'class Meta' got invalid attribute(s): base_manager_name HOT 1
- 'Library' object has no attribute 'assignment_tag' error HOT 2
- review modles is missing an on_delete positional argument HOT 1
- Support for Django>=2.0 HOT 1
- Will there be a Django 3.0 support? HOT 3
- how to use it with react UI
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-review.