What we want to achieve. I want to sort the movies according to their star ratings and filter the movies with lower rating than the specified threshold. 2. get the IDs of Movie and TV that are commented in the View, and get the data and score by url one by one. 3. Return it to the html and display
Tag: django
venv dependencies are being added without being downloading
I use virtual environments in my django projects. When I create my venv, I do like this from my command line This creates a folder called venv on my mac machine in my Dev folder. After I pip install django in the venv, I use the pip list command. At this point the list only contains the default django packages.
Django Query with 3 tables
I’m hoping I can get a little guidance. I’m trying to return data from 3 related tables in my template. In SQL, this is a simple approach, but the Django requirements have me stumbling. I’d like to display information similar to this: Here are a simplified representation of the models with the relationships defined. Here is my simplified view: And,
django model.objects.values() return related id instead of title
I want to get Chapter model data as json , i used values() method and it works but it return book id not the book title and i want the book title models.py views.py json ouput Answer You can use ‘FK__COL’ in the values(): Doc reference: https://docs.djangoproject.com/en/4.0/ref/models/querysets/#values
How can I make a user list of those who have given feedback on the particular product?
I have made a feedback form. Now I want to make a user list of those who have given feedback on the particular product. My motive is, that if any user gives feedback on a particular product, he/she won’t be able to give another feedback on that particular product and can’t see the feedback form. A user can share just
Reverse for ‘topic’ not found. ‘topic’ is not a valid view function or pattern name (another one)
I’m aware that there are quite a few similar posts like this one, but I still can’t figure it out. This is the code in the ‘topics’ template that links each individual ‘topic’ to it (also the code causing the error): Error being: Here is urls.py: Here is the topic function in views.py: Answer Look at second path – you
Not able to Update CRUD data with foreign keys despite putting correct namings
I am doing CRUD data which has foreign keys and serializers(since I am told to use serializers instead of Forms),even though I have put the correct model and it’s names in the product_edit page, the data is showing blank instead of thier saved data ,the wrong sub_category name is coming,this is how the edit page currently looks serializer: below are
Getting ID instead of Name in list
I am doing CRUD project with foreign keys and I am using serializers.I want to get the Name of the categories,sub categories,color and size instead of thier IDs serializer: models are: below is the insert function show function instead of name of categories subcategories color size etc I am getting id below is how the product_insert looks on webpage where
Detail view is not displaying content of models
My detail View in Django, isn’t successfully displaying the content selected from the listviews. The following is my code. Models.py: urls.py: Views.py: Html list view: Html detail view: I hope my query made sense. I don’t receive any error on myside, its just not working as it should. Answer The object data is passed as object and post_model, not Post,
Django: overwriting the method model of the abstract model, from inside the inherited models
I have a problem with re-assigning some var in my model, I have a model like this: but in the different models that used this abstract model, I need the use different expiration times in the exprie_time: so I am trying to overwrite this method in the model that was inherited from ExpireTime but it has no effect. so how