Skip to content
Advertisement

Tag: django

How can i fetch my data from database to django template?

Whenever I run this, Exception Value: name ‘current_user’ is not defined; error is raised. I am not getting where i am doing the mistake as I m new in django programming. Please help me fetch the data Answer It looks like you will be getting that problem from showproduct(request) because you don’t define current_user in that method before calling it.

how to register a tag in HTML django to make a string lowercase?

I have a python list, iterated over to display a bullet point list on a web page. I want to make each entry in the list lower case, but still keep the original case for what get’s displayed. I’m getting the following warning via Django below: My html: thanks Answer ref: https://docs.djangoproject.com/en/3.2/ref/templates/builtins/

how to return nested json using django rest framework

I am trying build a REST API using django. here is my models.py and serializers.py. models.py serailizers.py Here is my api – http://127.0.0.1:8000/api/city/Sidney/. I am trying to fetch data by city name. I am getting the json in below format. But i want the json in below shown format – i am not getting what change needs to be done

Deploying heroku – Push failed

I need some help to solve this. I don’t have much experience with Heroku, this is my first time doing it but I need to deploy some app really quickly. I’ve tried to disable collectstatic with heroku config:set DEBUG_COLLECTSTATIC=1 -a name_of_app But it haven’t made any change. Can anyone help me, please ? Here are logs: Answer in your Heroku

Check file extension in Django FileField

I need to run a different code depending on the extension of the file. This is a simplified version of the model: This is the part of the view that I have the problem: I don’t know how I should write this last condition above. With this version above, I get the error: The ‘python’ engine cannot iterate through this

Advertisement