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.

0
votes
0answers
5 views

Does Django support oracleDB nosql?

Im trying to use django with oracle nosql. I know django supports oracleDB but I don't know if oracle regular driver can be used by oracle nosql too. is there any driver for Nosql to support code ...
0
votes
0answers
9 views

Django query to get all formset images belonging to a particular object via foreign key relationship

views.py def TrainerDashView(request): if not request.user.is_authenticated: return redirect('accounts:index') else: page = request.GET.get('page', 1) notifications = Notification.objects....
0
votes
0answers
5 views

django.db.utils.ProgrammingError: relation “auth_permission” does not exist

I am having a working sqlite database in my local environment. On heroku I am using psql. But I am getting following error when I try to run $ heroku run python manage.py migrate Traceback (most ...
1
vote
1answer
25 views

Instance of list in ArrayField valid?

I have some user accounts with the field "donation_methods". A user can choose between different methods to accept donations. By default, every user should have the value 'cash' in the array ...
0
votes
0answers
8 views

Django password_reset Form email validation

Django password_reset Form does not check if email exists or not. Also validates form whatever email address is given. The question is, how do i check and throw error for non existing emails with ...
0
votes
0answers
8 views

How do I include all fields for my elasticsearch project?

I am trying to implement elasticsearch into my project. Right now it is able to search through the response field in my Response table, but i also want to be able to search through the other fields e....
0
votes
0answers
12 views

How to call my field validators in my save method in Django?

I have a model with a field that requires alphanumeric characters. I force this constraint using a validator. Something like this: from django.core.validators import RegexValidator ...
1
vote
1answer
18 views

Django model instance left open

Could there be any problems in case Django Model instance is left open and not saved? For example: qs1 = Foo1.objects.all().first() qs1.some_field ='Bar1' qs2 = Foo2.objects.all().first() qs2....
0
votes
0answers
6 views

Unable to write multiple QRCodes to pdf

I am trying to write multiple QR codes on a pdf file using reportlab, the problem is that QR codes are being written on one another. Snapshot attached. Here's the code: p = canvas.Canvas('rand.pdf')...
0
votes
0answers
16 views

Better way to file response with DRF?

I have this action: @action(methods=['get'], detail=True) def download_csv(self, request, pk, *args, **kwargs): project = self.get_object() data = show_stages_tasks(request, pk) ...
0
votes
1answer
13 views

Deploying django project with Apache

I am trying to deploy a django project with Apache but I got this error [Tue Oct 23 11:05:27.321603 2018] [wsgi:error] [pid 11440:tid 1308] [client ::1:7844] ModuleNotFoundError: No module named '...
1
vote
1answer
15 views

Django 2.1, How to show Foreign key values in template?

Sorry for my English level and my model is not good. Now, i'm stuck showing value in templates. purchaseinfo/models.py class Status(Models.model): type = models.CharField(max_length=...
0
votes
0answers
19 views

TinyMCE local file upload handling with Python

I am new to using Django. And I would like to customize TinyMCE editor for myself. I downloaded it and added to the project as a third part library, did not install it through pip. As you know, there ...
0
votes
1answer
6 views

'ManagementForm data is missing or has been tampered with' error when loading multiple model forms django

views.py @login_required(login_url='/account/login/') def TaskCreateView(request,pk,todo_id): if not request.user.is_authenticated: return redirect('accounts:index') else: ...
1
vote
1answer
18 views

Comma separated text instead of multiple selection on Django Form for Many to Many Field

So, I'm developing a web application to control the inventory on my company in Django (yes, I know there are plenty open source alternatives out there, we are in fact using fusioninventory right now, ...
0
votes
0answers
12 views

How can I pass in a parameter to my TestCase in Django?

Using an edited version of the example from Django's own doc, lets say my code looks like this: from django.test import TestCase from myapp.models import Animal class AnimalTestCase(TestCase): ...
-4
votes
0answers
14 views

cv2.imshow() function is opening a window for face recognition after recognition it not close in Django- python opencv

cv2.imshow() function is opening a window for face recognition after recognition it closes in Django but the problem is if I click face recognition button again cv2.imshow() is not workenter image ...
0
votes
1answer
19 views

Django password validators

Django 1.11.8 How could I change the password restrictions? I edited setting.py with this example: AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation....
-2
votes
1answer
12 views

How to upload multiple images for my product model in django?

I want to upload multiple images of the product so how can I do that? Django version is 2.1 and how to store the multiple files as well. Using python3 My model class Product(models.Model): owner = ...
1
vote
0answers
25 views

How to display an Excel sheet in Django?

im working on a Django website and i wnat to display an Excel Sheet that can later be edited on the website. Right now i am only able to upload a file but nothing is displayed. I know FileField is ...
0
votes
1answer
11 views

Template Tags not loading the intended output after loading onto Apache WSGI server

I loaded a Django project onto an Apache server and after a some research, managed to configure it correctly. The only issue now is that the bits of the pages generated by the template tag filters ...
0
votes
1answer
22 views

Invalid HTTP_HOST header: 'awssgp0-files.fds.api.xiaomi.com' request header attack

I am getting this request (more then 2000 per day) from different country . "Invalid HTTP_HOST header: ‘awssgp0-files.fds.api.xiaomi.com’. You may need to add u'awssgp0-files.fds.api.xiaomi.com' to ...
0
votes
0answers
9 views

How to enable the Is Visible Field in Zinnia blog (a django app)?

The Is Visible field in Django package Zinnia blog is not active in the admin interface for entries. As a result I cannot see any of my posts. How do I enable the same? If I publish it using Quick ...
0
votes
0answers
31 views

How to install a lower version of Django using pip in a virtual Environment

I'm trying to install Django 1.8 on a virtual environment in the server. using pip install Django==1.8 But It finds the newer Django version outside the virtual Environment and installs Django 1.11 ...
0
votes
0answers
11 views

DRF: Where should I place logic processing when saving an object

I am working on a small app where users will upload an Excel sheet (FileUpload model) and the sheet is searched for strings matching a particular RegEx. Strings matching this RegEx are the primary key ...
0
votes
0answers
13 views

DRF Django filter range for a CharField

I needed to save creation time as string in model, so I used CharField. But now I have problem filtering by queryparams for obtain objects in range of two times. I see that 'lte' and 'gte' are not ...
1
vote
0answers
12 views

django 2.1 checkboxselectmultiple

Please help.... I am new to django I keep getting this error on POST method when saving " Select a valid choice. ['DST', 'DAB', 'CGAA'] is not one of the available choices. " here are my codes; ...
0
votes
1answer
14 views

How to use an API from wholesalers to populate inventory on small business website?

I've been building some simple websites with django and am somewhat comfortable with it, enough to use models, templates and apps at least. Now, I'm making a website for a friends small business that ...
0
votes
0answers
16 views

How to serve images inside the document root folder using django and apache

I have deployed a django app using apache. Am using an app called django-ads which allows me to upload images. The app dumps the images inside the BASE_DIR folder so the image url is http://ip-...
0
votes
0answers
9 views

remote_addr value is not storing IPaddress in auditlog_logentry table in Django

I am using django-auditlog plugin. When I try to register a member into the database, the values are storing into a users table and its log entry is recorded in the auditlog_logentry table. But ...
0
votes
0answers
15 views

Migrations being applied according to User in models.py instead of being applied according to migrations in the database

I have written a custom django migrations command as shown below User = get_user_model() def populate_asset_assignee(apps, schema_editor): for user in User.objects.all(): user.save() ...
-1
votes
1answer
24 views

How to call a javascript function in from your views.py file in Django

Hi I have this JavaScript function: function calcscore(){ var score = 0; $(".calc:checked").each(function(){ score+=parseInt($(this).val(),10); }); $("#price").text(score); } $().ready(function()...
0
votes
0answers
20 views

can we retrieve the data by sending id field as json object using POST method in django rest framework

GET : http://127.0.0.1:8000/r/ { "count": 5, "next": null, "previous": null, "results": [ { "id": 1, "url": "http://127.0.0.1:8000/r/1/", "...
0
votes
0answers
8 views

How to make a SSL Websocket work with Django-channels

I'm trying to figure out how to get this websocket to work through ssl in https. Following the django-channels tutorial, I've made a similar web app to the tutorial and deployed it to Heroku. Heroku'...
0
votes
0answers
32 views

Django Password Reset Showing NoReverseMatch error

Here is my urls.py from django.urls import path, include from django.contrib import admin import staticpages.views as home_page_views admin.autodiscover() urlpatterns = [ path('', ...
0
votes
1answer
21 views

Django QuerySet for Counting items for each distinct field in any given month, including 0 value

#models.py class Orders(models.Model): orderid = models.IntegerField(db_column='orderID', primary_key=True) pickupdate = models.DateField(db_column='pickupDate', blank=True, null=True) ...
0
votes
2answers
41 views

Python 3.6 - What does “string % tuple” do?

I am writing a python module for an Django-based application that accesses an Oracle database via cx_Oracle. It "appears" that the django code has a bug that breaks the use of the cx_Oracle "...
-1
votes
0answers
10 views

Html Uploaded File to Python and Return Data Analysis Result Back to HTML

My question is that I want to allow my users to upload a tiff file, then I pass this file to views.py and do some data analysis and return an int and display the result in html when a button in html ...
0
votes
1answer
17 views

Problem with request.user.is_authenticated

I am writing a simple django view that takes username and password and authenticates it using authenticate(). However, after successful authentication, request.user.is_authenticated is still False. ...
0
votes
0answers
14 views

Displaying all of the fields of ManytoMany objects in Django Model Form

I am doing a simple invoice app and i encountered a problem with my django model form. Form is showing all of the ManytoManyfields objects but i would like to display all of their fields not just an ...
0
votes
0answers
13 views

unhandled exception with django and fastcgi

We have a Django application running on FastCGI on a Apache server hosted by Bluehost. It has been running smoothly for a long time. Suddenly every page is issuing this message: Unhandled Exception An ...
0
votes
0answers
8 views

How to async iterate over a queue of websocket clients in Django Channels using redis?

Consider the following scenario: 01) PHP Server with PostgreSQL a.k.a PHP 02) Python with Django Channels 2 with Redis a.k.a. PYTHON 03) Mobile Websocket clients a.k.a Client PYTHON has several ...
0
votes
0answers
5 views

sending email via rabbitmq async results cannot connect to smtp 10051

I have an email sending function that works from django shell but there are times I call it with delay() to be sent async. When done async with rabbitmq, I get the following error: I am sending ...
0
votes
0answers
20 views

Django rest with raw

sorry I have a problem with raw, I'm trying to add up the total sales for each month, but I have an error. this is my sight. class TotalSale(ListAPIView): serializer_class = TotalSaleSerealizer ...
0
votes
1answer
24 views

Django two forms interconnected in single template

I have another model which is like below class Status(models.Model): name = models.ForeignKey(User, on_delete=models.CASCADE) status = models.BooleanField(default=False) I just want to ...
0
votes
0answers
23 views

django send post data to url

I am creating a web service in Django that when called will call a stored procedure that will render data, that will then be changed to json and now I have to send it to a url with a userid and ...
0
votes
0answers
16 views

Solving problems in django when no debug message is displayed

I'm using this https://rock-it.pl/multiple-forms-on-one-page-in-django/ to try and include multiple forms in a single Django view. Here's my views.py class survey_detail(MultipleFormsView, ...
0
votes
0answers
19 views

Filtering an object with GenericForeignKey ContentType model

trying to filter and object with a GenericForeignKey get this error E django.core.exceptions.FieldError: Field 'pos' does not generate an automatic reverse relation and therefore cannot be used for ...
0
votes
0answers
16 views

How to make the search feature catch all types of keyword format in Django views

I'm trying to improve the search feature in my website. I use filter() multiple times to check if the search text matches with multiple columns. Everything is good so far, but the problem is when I ...
0
votes
1answer
24 views

Why Django stops execution if reverse relation does not exist?

I have a common situation: a User model and an Employee model which is related to User by one-to-one relation on user_id. My user model is customized and one of customizations is the method "...