Skip to content

Tag: django

Why django dependent dropdownn is not working

I cant tell where there is an error in my code. It just doesnt work as expected. My views.py My models. My forms.py I have tried but it works only after I select a year and refresh manually with the year selcted, that’s when the terms appear. I tried following the code by Vitor Freitas but couldn’…

Update a field of a Django Object

I’m trying to update an object field in django. Usually I would do something like this: The problem is that the field to modify (in the example above: “name”) is not known and passed as an argument to the post request. So I would have something like this: now this triggers the error: What is…

How can pass primary key to url Django

I have basically 3 issues I am trying to pass the primary key of vendor in url after creating it, but when i go the vendor page it shows the error ‘ Reverse for ‘vendorCategory’ with arguments ‘(”,)’ not found. 1 pattern(s) tried: [‘vendorCategory/(?P<vendor_id>…

converting a Django ValuesListQuerySet object to a float

i have time data saved (in epoch time) in a MySQL database as a IntegerField. i’m doing some data visualisation where i’d like to show orders by the hour and by day of the week as bar charts, so i’d like to convert these epoch times to date time objects and visualise the data accordingly. ho…

Obtaining full requested url address

I’m looking to obtain the full requested url within python/django. I’m wondering what package might help me do this. For example, if someone goes to example.com/my-homepage, I want to capture the string ‘example.com/my-homepage’ in python. Thanks! Answer