backend

How to get Category from Product? Django

How to get Category from Product? Django Question: I’m trying to create a search bar where user can choose Category and write product name. So I can display all products in that category where the name of product matches with what he wrote in text input. So I have Category -> Subcategory -> Product. Is …

Total answers: 1

Reseting Index in dataframe on Axis 0

Reseting Index in dataframe on Axis 0 Question: So I am trying to transpose a data that is coming from excel. Once I transpose it the Index numbers are located above the columns..so when I try to reset the index I get something like this: The problem is I need column names which I will …

Total answers: 1

reverse accessor model clashing Django Web App

reverse accessor model clashing Django Web App Question: from django.db import models from django.contrib.auth.models import AbstractUser class Customer(AbstractUser): address_line = models.CharField(max_length=255) city = models.CharField(max_length=255) postal_code = models.CharField(max_length=10) phone_number = models.CharField(max_length=20) origin_country = models.CharField(max_length=255) profile_picture = models.ImageField(upload_to=’customer_profile_pics’, null=True, blank=True) class Chef(AbstractUser): address_line = models.CharField(max_length=255) city = models.CharField(max_length=255) postal_code = models.CharField(max_length=10) phone_number = models.CharField(max_length=20) origin_country = models.CharField(max_length=255) …

Total answers: 1

Python and PHP compatibility in Web-Dvelopment, is it possible?

Python and PHP compatibility in Web-Dvelopment, is it possible? Question: I’m working with legacy PHP project where all back-bones was written in PHP. I like scriptting features, useful and fun things in Python. Question : Is it possible somehow implement Python scripts in PHP Back-end? Want to hear experts of web-development sector. Asked By: Ada …

Total answers: 1

Django: Is possible use _set into the filter() method?

Django: Is possible use _set into the filter() method? Question: I’m working on my ListView called IndexView on my polls app. This view currently return the last five published questions (not including those set to be published in the future). But my view also publish Questions that don’t have any Choice, so I also want …

Total answers: 1

model form doesn't render form again when form is not valid

model form doesn't render form again when form is not valid Question: I added Min and Max Value validators to my Django model and then when I enter a value out of this range, instead of rendering form again,it raises a value error. ValueError: The view cars_form.views.rental_review didn’t return an HttpResponse object. It returned None …

Total answers: 1

Error code 304 in flask python with GET method

Error code 304 in flask python with GET method Question: I’m new to python and I faced an error which I totally don’t understand why occures. In the Insomnia client REST API I’m creating item with POST method, and it works well, below it the code @app.post(‘/item’) def create_item(): item_data = request.get_json() if ( "price" …

Total answers: 1

Submit button is not working in html using django

Submit button is not working in html using django Question: HTML FILE in html page action is not added i wanted to know how i can submit the form without adding action attribute?? Asked By: ganesh || Source Answers: simply add your submit in the form tag: <form method="post"> {% csrf_token %} {{form.as_p}} <input type="submit" …

Total answers: 1

ValueError at /category/ The 'image' attribute has no file associated with it

ValueError at /category/ The 'image' attribute has no file associated with it Question: I am building an Ecommerce website in Django for the first time. Some how despite following the YT tutorial, I am not able to render image that are uploaded from my Django Admin Panel. Here are my codes: Models.py class Product(models.Model): name …

Total answers: 1