Category "django"

How to resolve Key Error Exception when accessing dictionary key inside an if statement

I'm currently developing EV calculator using python and django. I get a key error exception when trying to access a dictionary key in an if statement inside a f

Django - query Grand Children with Autofield as Primay Key

I have this model: class AnlieferungKopf(models.Model): kopfNr = models.AutoField(primary_key=True) firma = models.ForeignKey( Firma,

How to add collation in indexes for mongodb?

I work with Mongoengine in Django, got task to sort by first_name, last_name fields ignoring case and leading whitespaces that is why add collation in queryset:

What Python packages am I missing?

I'm trying to get my local Windows 10 PC up and running with my Django application. I'm a novice at Python and Django. My app was written by another developer w

User draw rectangle on leaflet map and post the coordinates on django form

I would like to create a djagno app, which will enable users to draw a rectangle on a leafet map and post the coordinates in order to create a vector. Firtsly I

Django Authentication method is not working

I am trying to use the default Django from django.contrib.auth authenticate() method to authenticate if the user exists. I am doing this right after the user re

URL and page refresh issue for Multilingual site on Django

plz help me to solve one issue. I have a Multilingual site on Django with standart internationalization framework. Settings.py MIDDLEWARE = [ ... 'djang

How to change the database local to be in a cloud (Django)

I wrote a project in django framework and I use the local DataBase SQLite, and I now want to upload it to the cloud so other people who work with me can access

HTML name/value button attribute not being sent via POST request to server

I am currently using HTMX and Django to process button clicks within a table that adds the selected item to a list. I am trying to use the name/value HTML attri

Django processing form input name

I have changed the input's name attribute to some custom name, but the view calls form_invalid method. Why my Form isn't saving (validating)? html: <tr>

It shows, Field 'id' expected a number but got ''

When I submit then shows this error. views.py: class userINFOupdate(View): def get(self,request): userid = request.GET.get("user_up_id") u

Can't set default image django

I was create a profile for user. I done set up all the Media and Static. But when I set default and upload_to in image field, it error not found image. I had tr

Queryset filter to filter response that exactly contains the value as substring in django views

I have created filters that filter API responses, if the response contains at least one letter in the value as substring, I need to create a filter to filter re

Improperly configured error says I'll have to define env variable DJANGO_SETTINGS_Module .Please help me solving this problem [closed]

So I m just a newbie trying to learn django .. i was just trying to copy what Harry did(a youtuber who teaches code) but I got stuck right aft

send template data from signal in django

As soon as the django user_logged_in signal works, I want to send data to my template at that moment.I need to check if my signal is working. from django.contri

Representing Django M2M data export in a CSV

The problem I am trying to solve is to export all the entries of a Django model as CSV. The field names are supposed to be headers, with each row having an appr

What is if 'admin' in request.path

I followed YouTube Django E-commerce video, I did exactly the same as the tutorial. But I found some difficulty in certain code. CONTEXT_PROCESSORS.PY from .mod

How to display extra context and form fields at the same time on django template using class based view?

I am trying to display some extra context on the page, but when I adding get_context_data method it is displayed context but not a forms fields. This is because

Difficulty converting html page with CSS and images to PDF in Django

I am trying to convert an HTML page which uses quite the bootstrap and styling. I tried everything from reportlab to weasyprint to xhtml2pdf and nothing works!

Move HTML variable through views to python script in Django

While working in Django I am trying to take a variable from HTML input, pass it to views.py for some decision making, then pass it from views.py to a separate p