Relative Content

Tag Archive for pythondjangodjango-modelsdjango-views

i always get error on this statement even if statement is false or true if password != confirm_password: print(“Password error”)

if password != confirm_password: print(“Password error”) return redirect(“user_register”) else: if User.objects.filter(email=email).exists(): print(“Email already exists”) return redirect(“user_register”) else: if User.objects.filter(username=username).exists(): print(“Username error”) return redirect(“user_register”) else: user = User.objects.create_user(username=username, email=email, password=password) user.save() data = Customer(user=user, phone_field=phone) data.save() # Code for login user again our_user = authenticate(username=username, password=password) if our_user is not None: login(request, our_user) return redirect(“”) else: […]

NOT NULL constraint failed on PUT request in Django

I’m new to Django and I’m having trouble handling form-data and raw data in PUT requests. I need to update records of a Person model via a PUT request. The Person model has several fields including fname, sname, age, and gender, all of which are required.

Django: Vendor Dashboard Not Displaying All Orders for Products Sold

I’m working on a Django project where I have a vendor dashboard that should display all orders for the products uploaded by the current vendor. However, the dashboard is only showing orders placed by one user and not orders placed by other users for the same products.

Django: Vendor Profile Not Detected Despite Being Created

I am working on a Django project where each user can have an associated vendor profile. I’ve created a vendor profile for a user, but when I try to access the vendor’s shop, it always renders the no_vendor.html page, indicating that the vendor profile does not exist.

salut problement sur django

Hi please I can’t share my project developing in django in network so that another machine can access it in the same network as me I don’t know what to do I have already run on 0.0.0.0:8000 and in addition to this ALLOWED_HOSTS = [‘*’] is configured comsa when I type the ip address of my pc on the other pc without the port I access apache2 but when I add the port it says that this site is inaccessible need to ‘help

I want to create a json file from my Django sqlite3 database as a backup rather than displaying it on a webpage

I am able to get the data from my sqlite3 database and project it in a webpage in Json but am having trouble replicating that when wanting to create a file. I am new to python, Django and working with databases. I have been looking around and tried several pieces of code, but the information I could find pertained to what I have already achieved, which is displaying the data on a webpage.