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
4 views

Heroku Django requests static files that don't exist

Using whitenoise for managing production static files. Django==2.1.4 whitenoise==4.1.2 My production server is requesting static files that look like mine (ie bootstrap.min.js) but have characters ...
0
votes
1answer
12 views

How to connect both website and android application into one firebase database

I am having trouble on how will I access all the information needed because I am creating an android application and a website having the same data in it. I want to see that the data I enter in the ...
0
votes
0answers
7 views

How to redirect tenant to subdomain

I am using django-tenant-schemas to add multi-tenancy to my SaaS website but have not found a good way to redirect tenants to their subdomain automatically. Obviously the tenant will be denied login ...
0
votes
1answer
13 views

How can i give form and field validation to my fields?

I want to add some validation if user try to register or login he must go through some restrictions. Please help me someone as i am new to django models.py class RegisterData(models.Model): ...
0
votes
2answers
15 views

ReactJS not displaying Django REST Framework API data

I am trying to use ReactJS to build a simple website that pulls data from my Django REST Framework API. The issue I am running into, is that my data is not being output by React. I am certain that my ...
0
votes
0answers
13 views

Django infinite scroll messed up design. CSS need correction

I am developing one website using Django. The website link is, http://34.66.79.236/listings/ You can see that the tiles on the website has got overlap on each other. This happened after I implemented ...
0
votes
1answer
6 views

File (.tar.gz) download and processing using urlib and requests package-python

SCOPE: Which library to use? urllib Vs requests I was trying to download a log file available at a url. URL was hosted at aws and contained file name as well. Upon accessing the url it ...
0
votes
1answer
23 views

I can't get parent page query in wagtail

I have tried this code but always return an empty query, and i don't know why. parent = MangaPage.objects.filter(title=Page.get_parent)
-4
votes
0answers
23 views

403 from Jquery in Django

Yes, I have learned that it has to do with the csrf stuff, yet none of the copypaste I have found around has worked. (example below) The second question I ask myself is that I dont seen how from the ...
-1
votes
1answer
14 views

pythonanywhere // python manage.py collectstatic = 0 static files copied to // 175 unmodified

why my static files don't load? CMD /PruebaApettito.FINAL/PruebaApettito.FINAL-master/Prueba2/proyectoapettito (master)$ python manage.py collectstatic You have requested to collect static files at ...
0
votes
1answer
28 views

Why am I getting this error “local variable 'text' referenced before assignment”

I am trying to create a share function using python and Django and when I run "share" it gives me back an error. Here's my code: views.py from django.shortcuts import render from basicapp.forms ...
0
votes
0answers
21 views

I cant get this angular authentication using token to work

There is an App x and App z. App x is a django application. App z is an Angular application. I want a scenairo where if the link to app z is clicked from App x, the token of that user is sent with ...
0
votes
0answers
8 views

Nested Caching in Django

I have an HTML partial, which has a background image that Id like to cache. The partial itself contains dynamic content, though, so I cant cache the whole partial. Is there any way around this with ...
0
votes
0answers
8 views

How to solve ModuleNotFoundError: No module named 'mass' (from gmane)

System info: pip3 --version pip 19.3.1 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7) python3 --version Python 3.7.1 sw_vers ProductName: Mac ...
0
votes
0answers
9 views

Django Pytrends calling results Type Error Object of type QuerySet is not JSON serializable

Firstly, I have looked at previous documentation from previous questions, but they are not super similar. In pytrends, you have TrendReq, and then build payload which requests the data from google ...
0
votes
1answer
21 views

Django html page wont allow post with multiple items

I have a html page that runs a for loop to populate students on a board. Here is screenshot and the code. Issue: The issue is if i have more than one student in the class , no matter which button on ...
1
vote
2answers
57 views

How can two Python applications hosted in different servers communicate?

I'm having an hard time figuring out how to solve a problem with a little project. Basically i have a Django application. On the other hand i have an external Python script running. I would like to ...
0
votes
1answer
26 views

How to add 'Delete' button to User Profile template in Django app so the user can delete his/her profile from the app?

I have an app login/logout system in which I automatically generate user profiles once user is registered. My Profile.html looks like this: <div class="col s12"> <form method="POST"> {...
0
votes
1answer
31 views

Difference between UpdateView and BaseUpdateView - Django

My Doubt is: Difference between UpdateView and BaseUpdateView and how to use them I have tried to find information on the subject, but it is not much, so I have the doubt how to use exactly the ...
0
votes
1answer
19 views

Django get() missing 1 required positional argument: 'header'

Every time i do a successful post request i get this message. I know it has something to do with implementing the redirect function so you don't get a double post, but i cant get it to work right. ...
0
votes
1answer
25 views

Passing a value from html template to views.py in Django

can you please help me with the issue I'm experiencing? Basically, I followed a tutorial online to create a location-based application that displays the shops around the user's location. However, the ...
0
votes
0answers
18 views

500 Server Error Serving Static with Whitenoise

Apologies for the length of code in this, I wanted to make sure I include as much as necessary for troubleshooting purposes. I have a Django application that needs to serve static files in ...
0
votes
0answers
18 views

Invalid template library specified. ImportError raised when trying to load 'compressor.templatetags.compress': cannot import name 'six'

I'm trying to add .scss to project by this tutorial. With Django 2 it works fine. But with Django 3.0 I'm getting an error. I'm creating new project with django-admin startproject mysite Then doing ...
1
vote
0answers
25 views

Django - what is the best way to avoid doing repetitive queries in a dynamic navbar?

I'm currently developing a project which has two apps. When the user logs into the system, the navbar will show the links according to what permissions the user has in the database. If the user only ...
1
vote
1answer
31 views

How to filter a query on Django ORM

I know this should be pretty basic but somehow I don't quite get it. I want to get all users which age is lesser than 18 so the query should be something like this User.objects.filter(age < 18) ...
1
vote
1answer
43 views

Django - If i put 2 formsets together in my view, the function to add multiple times the same views doesnt work

I have this code bellow. Im using formset to add multiple times the same form. But if i put this 2 formsets together, like in my view, just the first data for each form is saved. And if i put just 1 ...
0
votes
0answers
22 views

Post HTML input tag file data to another input tag file and retrieve in Django views

I'm trying to send one <input type="file"... value to another <input type="file".. using Javascript. I've created an HTML form and after filling it, I want to review the form. Then submit that ...
0
votes
1answer
31 views

Chaining querysets in managers

I am looking for a way to reuse this abstract model/manager with queryset on the models that require soft delete but some of my models already have custom managers/querysets. Ideally I would like all ...
0
votes
1answer
17 views

KeyError when passing kwargs to ModelForm

I'm trying to create a custom field for my M2M field in my ModelForm. ConnectedTo is the many to many field. Code below: views: def addPartForm_Create(request, site, subtype): siteselected = ...
0
votes
0answers
17 views

pytest, How do you break up rather long test?

I'm writing my first pytest test, and it is rather long (currently 120 lines) It tests the store's checkout process, What it does is roughly following: grab product info add_to_cart add purchaser ...
-4
votes
0answers
36 views

functionality as a method instead of Django Class Based Views approach [closed]

I am wondering how to write this functionality as a method instead of Django Class Based Views approach? from django.shortcuts import render from django.contrib.auth.forms import UserCreationForm ...
0
votes
1answer
24 views

How to figure out NoReverseMatch at / in Django

Hi and thank you for your time Im using Django and i've got a following issues: NoReverseMatch at /dashboard/. NoReverseMatch at /event/. When i try to go to the dashboard page or to the event_list ...
1
vote
0answers
15 views

How do I make and access regex capture groups in Django without RawSQL?

How do I annotate a Django queryset with a Regex capture group without using RawSQL so that I later can use that value for filtering and sorting? For example, in PostgreSQL I could make the following ...
1
vote
2answers
41 views

URL to function in views.py from jquery

I have read the 2 posts related to this subject. Can't make them apply to my case: After lots of wrestling, I have solved some things but I am not indicating the URL to the view function correctly ...
0
votes
0answers
14 views

Django 2.2.x returns on specific computer: The requested resource was not found on this server

I have the same code running under Django 2.2.1 (also tried 2.2.5). Serving the page with python manage.py runserver The login page and also admin page is served. But after login there is a ...
0
votes
0answers
16 views

How Not Duplicate Submit Form - without JavaScript - DJango

The objective of this is create an input where the user introduce username, there are 2 buttons that submit the form with OK or NO. The problem is that when I submit the form everything is going well ...
0
votes
1answer
23 views

Django - Form (populate field with instance)

obj = Contact.objects.get(id=1) return is -> 124571 myName from my database instanceForm = ContactFormDjango(request.POST or None, instance=obj) ContactFormDjango was a form field with contact ...
0
votes
1answer
25 views

When and how to use form methods

I am reading the Django documentation and ran across a couple examples in the forms sections that I do not understand why they did something 2 separate ways.. In the first example I found they send ...
1
vote
0answers
18 views

Add an Image field and audio field on the front end. Using Django backend and reactjs front end

I need to add an image field and audio field in the front end. The Audio file should be accepted from a user in the front end. Then, ml file should be given the accepted file for processing and a text ...
0
votes
0answers
25 views

Django - Bad request syntax or unsupported method

I want to post data via an api onto my django app. This is how far I got: import pandas import requests excel_data_df = pandas.read_excel('workorders.xlsx') json_str = excel_data_df.to_json(orient=...
1
vote
0answers
14 views

Connect two Django apps with same initial workflow

I have a django project whereby the initial workings of two apps is essentially the same. Therefore, I have split the initial workings (a couple of forms) into its own init application. The idea is ...
1
vote
1answer
27 views

Django M2M field in a Model Form?

I have a many to many field ConnectedTo in my model and I want to create the object using a form. However when I list it as a field I just get a listbox with options to highlight and no way of ...
1
vote
1answer
12 views

Remove From cart Button not working in django?

When i try to remove item from my cart, remove from cart button accessing add-to-cart definition and when i click on remove button, it increase item in the cart means both add-to-cart and remove-from-...
0
votes
1answer
23 views

Django query - How to get concurrent number of records in 5 minutes span of time?

I'm very new in Django and Sql. Sorry for this basic question. I have below model with Django + PostgreSql to record activity start/stop time; class Test(models.Model): class Meta: ...
-1
votes
1answer
24 views

In my Django portal after login to the portal my request.user is always giving the value AnonymousUser

def login(request): if request.method == 'POST': form = AuthForm(request.POST) if form.is_valid(): userEmail = strip_html(form.cleaned_data['auth_email']) ...
0
votes
1answer
19 views

Accessing dictionaries in Django templates

views.py: return render(request,'images.html',temp) Temp: {'cluster1': ['temp/vinoth/cluster1/demo-pic94.jpg', 'temp/vinoth/cluster1/id1.jpg'], 'cluster2': ['temp/vinoth/cluster2/demo-pic94.jpg', '...
0
votes
0answers
12 views

How can I properly catch errors of a Node js script in Python using Naked?

I am using Naked library of Python mentioned here for executing a Nodejs script which is also available here too. The point is, whenever I run my python script(exactly taken from the above link) ...
3
votes
1answer
45 views

__init__() takes 1 positional argument but 2 were given login page

So I am new to python and I have been trying to make a very basic login page and whenever I look up this error all the solutions are very specific to the persons code. I am learning python for my ...
1
vote
1answer
9 views

Why must context be retrieved via the get_context_data method of the generic class DetailView?

I have a simple question which i will explain. I am reading about generic views using the docs on djangoproject.com, On this page they show the following example: from django.utils import timezone ...
0
votes
1answer
12 views

How to set `lookup_field` correctly for `HyperlinkedIdentityField` in Django Rest Framework?

I need to change default HyperlinkedModelSerializer urls. According to documentation, I have to either define url field manually like this: serializers.py class StockSerializer(serializers....