Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [django]

Django is an open source server-side web application framework, written in Python. It is designed to reduce the effort required to create complex data-driven websites and web applications, with a special focus on less code, no-redundancy and being more explicit than implicit.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 views

Customize a view handle POST and DELETE method in django rest framework

I created a View that can handle POST and DELETE method class MyView(APIView): def valid_method(self,data): method = self.request.method if method == 'POST': ...
0
votes
0answers
6 views

AH01630: client denied by server configuration: /djangoDeployments

I am deploying a django application but I am having problems with the apache2 configuration. It gives me the error: AH01630: client denied by server configuration: /djangoDeployments I already ...
0
votes
1answer
11 views

Saving new django model object gives duplicate key

Django 2.2.3 on Python 3.7, with Amazon RDS Postgres Database. Saving a new object doesn't work for this Company model: class Company(models.Model): name = models.CharField(max_length=255, ...
0
votes
0answers
6 views

How to pass a function from view.py to html

views.py def detect_full_text(tweet): if 'retweeted_status' in tweet.*_json*: analysis_tweet = tweet._json['retweeted_status']['full_text'] else: analysis_tweet = tweet.full_text return (...
0
votes
0answers
8 views

Django testing with Multithreading, changes to database don't persist

I am attempt to replicate an issue we are experiencing on our production server where it seems if two requests are made to save or update and existing object, if made at a very close interval will ...
0
votes
0answers
6 views

my url giving me this error invalid literal for int() with base 10

Hey guys i need some help in my url, im having trouble with url path, as you can see in my code i want my url /invitobidetails/ "id" = 1/"title" = Re-bidding of the Procurement for the Supply, ...
0
votes
0answers
6 views

Why cann't i not access media

I seem do not understand what i am doing wrong. I have done research online to see if there is any changes, but yet none. Bellow is what i did settings.py STATIC_URL = '/static/' STATIC_ROOT=[ os....
-1
votes
1answer
10 views

Weather API not getting data from other locations

**I am creating a weather app in django and i want the users to be able to search for weather on any locations using the API...i have tried multiple times to use the HTML input but it's not working ...
0
votes
0answers
5 views

How to find the acme challenge response?

I'm using a django-letsencrypt and it requires me to enter in the acme challenge and the acme challenge response. I'm able to find the challenge but I'm not able to find the proper response to use. ...
0
votes
2answers
13 views

Creating Django´s blog Post custom fields

I am new to django, I am trying to add custom fields to the regular django blog Post App. This is the blog fields out of the box: models.py from django.db import models from django.contrib.auth....
0
votes
0answers
14 views

How to Use Django File Storage to Share Files Between an API and a Worker

Goal I want to build a local docker compose deployment such that I have 5 services. Redis Postgres RabbitMQ Django API Django Worker In this deployment the user uploads a file via the API endpoint. ...
0
votes
0answers
12 views

MySQL startup ERROR! The server quit without updating PID file

I'm trying to start mysql in a Mac using sudo /usr/local/mysql/support-files/mysql.server start. I keep getting the following error - ERROR! The server quit without updating PID file (/usr/local/mysql/...
0
votes
0answers
18 views

how do I add a friend system to my carpooling app

I am creating a website for carpooling as a class project. I need to implement a friend system on my website. It is just a simple friend system where users can add or remove another user as friend, no ...
0
votes
0answers
13 views

Removing newlines from the end of base.html file makes some elements disappear from DOM

This is a strange bug. I have an html file that extends a base template called base.html. I noticed that a script tag right before the end body tag in the base template doesn't show up in the DOM in ...
0
votes
2answers
10 views

Django: how to have dynamic values in separate javascript files?

I would like to keep the javascript logic in separate files from the Django templates. However, some of the logic contains dynamic values which I would like to still be rendered just like templates. ...
0
votes
0answers
7 views

Howto configure Gmail account / Django Mailbox to receive incoming mails

I want to process email from a gmail account via Django. I installed latest django-mailbox. I created a gmail account, and created a Mailbox in django admin: imap+ssl://EMAILADDRESS%40gmail.com:...
0
votes
0answers
11 views

Can't get Django's get_absolute_url to set up the link properly

I am trying to use the get_absolute_url function in one of my templates like so: template.html <div class="card-columns"> {% for category in main_categories %} <div onclick="...
0
votes
0answers
7 views

Filter json records in Django Rest Framework

I created a DRF API endpoint in order to be able to grab some data to my database and show it on my Django page using Jquery. My sample data looks like this: { "item": "Someitem", "Price": ...
1
vote
0answers
7 views

Bootstrap 4 Multifield Equivalent

Django Crispy Forms has a multifield layout for the uni-form template pack - https://django-crispy-forms.readthedocs.io/en/latest/layouts.html#uni-form-layout-objects. Errors in the form are shown in ...
0
votes
0answers
18 views

I don't know why Nginx server is not working

Hi there i'm trying to put in production some django app using nginx + gunicorn + supervisor. Following this guide i was able to reproduce all steps with success but for some reason i can't make it ...
1
vote
0answers
11 views

I am having issues uploading a Python project (using Django) to Heroku

I am trying to deploy a Python project to Heroku. When i press the "Deploy Branch" button on the Heroku website ... https://dashboard.heroku.com/apps//deploy/github i get this error. Installing ...
0
votes
1answer
49 views

check if string matches first n characters of regex

I have a python site built in Django where a user will be uploading files that they may or may not have permission to add. The permissions are created through a series of regex patterns (there is over ...
1
vote
1answer
14 views

Django Rest Framework tests fail and pass, depending on number of functions

I have a test class in Django Rest Framework which contains a function which passes the test if it is the only function in the class, or fails if it is one of two or more functions. If I run the ...
0
votes
0answers
18 views

how i do post request with python-requests-library, if in my model i have images field

i need a help, i creating telegram bot , bot get to api post request, and in my model i have images field, when i do post request, i got a fail "bad request" 400, how i can fix this problem? ...
1
vote
0answers
21 views

Django function view to update two templates (current and base)

Django Beginner. I have a functioning Django app (models, views, urls, templates) similar to what you can see in tutorials. I would like to return some debugging and user information (e.g. if an item ...
1
vote
0answers
17 views

Why use UniqueTogetherValidator over Django's default validation behavior?

I have a Django model defined with a unique_together relationship defined between name and address, shown below: class Person(models.Model): name = models.CharField(max_length=255, default='', ...
1
vote
1answer
31 views

error: “int() argument must be a string, a bytes-like object or a number, not 'list'” in decorator @action

Good afternoon I am doing an @action decorator to a viewset in django rest to filter my model by a field and some values in an list ​​and thus obtain (properties) values ​​that will be consumed in the ...
1
vote
0answers
23 views

Getting Object based on its ID

Setup I am trying to write a DeleteView that will delete an object based on its Id. The object is a journal and I want to reference the Journal that the user is currently located in. So for example ...
1
vote
0answers
10 views

Adding file upload widget for BinaryField to Django Admin

We need to store a few smallish files to the database (yes, I'm well aware of the counterarguments, but setting up e.g. FileField to work in several environments seems very tedious for a couple of ...
1
vote
0answers
12 views

List or table with field names as a column other than header

I am wondering whether it is do-able to make a list or table or any other solutions like:          Time 1    Time 2 FieldName1   a_Value1  ...
0
votes
2answers
25 views

how to add two fields as foreign key to a table?

I have two tables "team" and "match". every team can be on different matches and every match contain two or more teams and so it's a manytomany relation. here is my match model: class Match(models....
0
votes
1answer
16 views

Django settings.py

At my project login, some settings.py environment variables are loaded to enable some behaviors: unit_id = settings.COMPANY When another user logged in the system changes the value of this variable, ...
0
votes
1answer
13 views

how to control the for loop if the value is already detect?

\html <select id="payments" name ="payments" onchange="payment(this.value)"> <option value="0" name ="yearlvllist">-- Payment Type --</option> {% for paymentschedule in ...
0
votes
0answers
13 views

What is the source of slow response time on client when server is fast, in Python web app hosted in Azure

I have a simple Python web app hosted in Azure. Here are the details: Azure App Service for Linux (Basic Service Plan - B1 with 1 core) Django framework Postgres backend via Azure Databases for ...
0
votes
0answers
6 views

paginator reset query as i change page

I am developing an app in Django. I have a template in which are displayed data from my model. The template has a search bar and also a paginator. The problem is that, when I run a query (let's say ...
0
votes
0answers
12 views

Python social auth: default Django backend doesn`t authenticate users

I want to add authentication with different auth providers to my Django project, so I decide to use python-social-auth. I’ve configured my settings.py as mentioned in an official docs. And Django ...
1
vote
1answer
17 views

CSS changes not appearing - Django

When I make new changes to my css the new changes are not showing. If i delete a style it still shows and if I delete my <link> tag all the styles disappear. I can edit styles with inspect ...
0
votes
0answers
18 views

Rendering a pandas dataframe on-page in django

I have created a page with Django where you can upload an excel file and it will save into the /media folder. Once it's uploaded, there is a page that shows a table of the uploaded files. I have added ...
0
votes
0answers
8 views

django form: CheckboxSelectMultiple's id_for_label does not work

I want to customize my label style, so I overwrite {{ form }} in my html template with a for loop through all choices. But I found I lost label 'for' attribute and 'id' of the input for each choice ...
0
votes
0answers
21 views

Save data in Foreign key tables using django rest framework

I have 3 tables in a sequence with foreign keys like this 1st table class Orders(models.Model): restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE, blank=True, null=True) ...
0
votes
1answer
16 views

Upload multi img to 1 post on Django ? How do that?

I want to upload multi img to 1 post on Django. I used ImageField in models.py. But it's just can upload 1 image to 1 post. How can i upload multi image to 1 post with Django or someways to solved ...
0
votes
0answers
12 views

dataSource in mat Table using Angular Material in Angular 8 get method

i try to create a Mat Table using Angular and Django for build a filter and pagination method,etc. the thing is this i'm using Django like backend and Angular Fronted, and i have the method Get ,...
1
vote
1answer
15 views

How can I make a Google Map marker redirect to a URL?

Here is my html: {% extends 'base.html' %} {% block title %}Home{% endblock %} {% block content %} <style> /* Set the size of the div element that contains the map */ #map ...
0
votes
0answers
14 views

Django_filters multiple arguments for non-model field

I need my endpoint to accept queries in the format: groupId=11111&groupId=22222 and resolve to a query: groupId=1111 OR groupId=2222 I couldn't find anything in the documentation on how to do ...
0
votes
0answers
11 views

How to mimic Python's open(filename, 'r') in Django context on uploaded file?

I have tried parsing same GPX file both in and outside of Django context. In a standalone script everything works fine while reading the file in the default text mode: import gpxpy def ...
0
votes
0answers
26 views

How to use JavaScript variable as django tags template parameter?

f I use the code as follows it works: function filter() { var assuntos = document.getElementById("assuntos").value var data = '{{ "CONTRATOS"|filter_assuntos }}'; change(data); }; but how do ...
0
votes
0answers
10 views

Django DRF, changing authentication schemes from JWT to basic token

I have a Django app that was originally using drf token authentication. Everything was working perfectly. Then I decided to switch to JWT's. I made all the changes and everything was working ...
3
votes
0answers
24 views

Nginx: No such file or directory

I have a vps server by Reg.ru and domain by freenom. On the Reg.ru I added domain via dnsadmin. All right. Notes are created. Status - synchronized. On the freenom in the management panel of domain ...
0
votes
1answer
19 views

How to save two forms in one model in Django?

I have two Django forms of the same model in the same view, so when I try to save them I get two objects of the model and my goal is to get one single object with the data of both forms. I've tried ...
0
votes
1answer
13 views

(Django) Displaying multiple generated forms (unknown quantity) in the view, and retrieving their results?

I'm currently attempting to display a set of generated forms into the view. So take the following view, for example (as part of a TemplateView class): def get(self, request, id): df = ...