Category "django"

css and other assets not loading for my django webapp

CSS, JS, fonts, images and other assets are not being loaded into my django app index.html. All the assets for the app are present inside the application app in

How do I prevent a 500 CORS error when attempting to create and download a csv file containing a large data set using python's StreamingHttpResponse?

The function runs and works perfectly fine for a small data set, but for a large data set, the following error is produced: (URL is hidden in the red) A 500

Failed running 'collectstatic' exited with exit code when deploying Django to Azure Web Service -

I am trying to deploy a Django app to Azure App Services. It runs on the server now, but without the style.css. When I run it on localhost, everything shows cor

Django forms User form not summited

I need help with my code. I have read through the code several times and I didn't see anything wrong with it. The user is expected to submit a job application a

django-ckeditor modal form does not change data on POST

I have a django project using django-ckeditor. I use HTMX to create a bootstrap modal to show my edit form. It renders correctly (I did add the ckeditor.js fil

Configuring CSRF tokens with apollo client and graphene-django

I am having trouble properly setting up csrf tokens in the authlink header. const authLink = setContext((_, { headers }) => { const token = localStorage.

Django. How to make ModelChoiceField work with SingleObjectMixin, FormView, and inlineformset_factory?

This shouldn't be hard How to show in a Django Model Form just the related records from Model.B for the user to choose. Ginven that it is provided the Model.A a

How to add two fields of django model and save the sum in another field?

class example(models.Model): var1 = models.IntegerField(default=0) var2 = models.IntegerField(default=0) var3 = models.IntegerField(default=0)

Django queryset by first letter?

For example my name is David and my friend is Daniel. I want to show these two names in their first letter wise . Item has a 'name' field. In the template I wan

Django Assigning or saving value to Foreign Key field

can any one help me with assigning value to a foreign key field. Im trying to create user profile where user can add there countries. when creating the models,

django.db.utils.IntegrityError: null value in column "id" violates not-null constraint

I want to save data from the Django model to PostgreSQL database with: mymodel.objects.create(title='test') this model only has title and id but it raises th

How to create a requirements.txt file in Django project?

I have been trying to create a requirements.txt file from the Pycharm terminal but it is adding all unnecessary packages as well. What should I do to show only

HTMX for messages from the backend in django

I wanted to use HTMX to show messages from django backend after a lot of trial and error I ended up with a working solution, that I want to leave behind for any

How do I add my html navbar into another html file in django

I am still very new to Django and I want to add the HTML for a navigation bar and its respective CSS into my base HTML file. Here is what I did up till now: in

Cannot run program "/../../python.exe" (in directory "/PythonSoftwareFoundation.Python.3.8_3.8.240.0_x64__qbz5n2kfra8p0"):Access is denied

I'm getting this error anytime when creating a new project in pycharm: Cannot run program "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.

Change renderer class inside custom pagination in django rest framework

I am using custom renderer class by default in settings.py. For api I check query parameter "page", if it exist then I paginate result else return normal respon

How do I add my html navbar into another html file in django

I am still very new to Django and I want to add the HTML for a navigation bar and its respective CSS into my base HTML file. Here is what I did up till now: in

Django - export excel make it faster with openpyxl

I am using Django restframework and I am trying to export excel. My issue is the process is take a lot of time till it generates the excel file. The final file

Django Google App Engine: 502 Bad Gateway, already installed package not recognized

I'm deploying Django in Google App Engine. I get 502 Bad Gateway and in the log I get the following error: 2021-03-08 12:08:18 default[20210308t130512] Traceb

How to add attributes to a Django form widget's media fields?

I can render media files for a django form, through a custom widget, like this: class TinyMCEWidget(Textarea): def __init__(self, attrs=None): if a