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
1
vote
1answer
19 views

Django Images In Media Not Displaying Despite Correct Settings

I'm trying to upload an image from a form and display it on another template, however the images in media cannot be found. Model class Upload(models.Model): image = models.ImageField(upload_to='...
0
votes
2answers
20 views

Unable to Access Other Apps in Django

I am writing a beginner Django app. I am currently able to the first app that I created. However, I am not able to figure out how to access the other two apps. swiss (project) |_ app_picker (...
0
votes
0answers
9 views

How to access django models from a scheduled script?

TL;DR: I have an app that I want to run a routine every day at midnight (for that I'm using APScheduler). In the middle of this routine it's supposed to access data from a few django models. The ...
0
votes
1answer
15 views

Django - Taking values from POST

I'm passing some data to my template ("appointments.html") which looks like this: Appointments today Appointment ID : 84218332 Scheduled Time: 2019-10-18T01:00:00 Arrived Appointment ID : 84218332 ...
0
votes
0answers
7 views

How to load template that it has own css like bs3 to another page?

I have a form that it has Bootstrap 4 CSS classes. I want add jquery image upload code in my form but this codes have Bootstrap 3 CSS classes. I put my jquery block to image_block.html with {% load '...
0
votes
0answers
13 views

How to link rows from one table to rows of another table in Django?

I have to four tables: class Instrument(models.Model): name = models.CharField(max_length=100, null=True, blank=True) instrumentation = models.ManyToManyField(Instrumentation, verbose_name=_('...
0
votes
0answers
7 views

Heroku (DjangoRF/React App) react router works but urls don't work while refreshing or writing manually

I've got APP working on Heroku. It has DRF API backend and ReactJS frontend. React routing works properly but when I refresh page or write URL manually it throws django 404 URL not found error. ...
0
votes
0answers
12 views

how to get amp template in django

thaks for your time. i've beeing trying to work with AMP for front-end and django for the back although i've been having some issues with the tags. Ex(amp-carrousel): <amp-carousel class="cars" ...
0
votes
0answers
19 views

can i use jQuery in Django framework

I'm writing a Django Full website and trying to change the element using jQuery OR JavaScript but I couldn't I want to change the total <tr> <td>{{i.itemname}}</td> <...
0
votes
0answers
8 views

Is there a way to restrict outbound traffic on a Django function?

I have a function in my Django app and I'd like to ensure there is no outbound network traffic from it while still being able to return a response. For example, blocking the POST request to an ...
0
votes
1answer
16 views

Filtering data in real time in django forms

I have two problems strictly. The first is the problem with the field type in forms.py. Because I'm trying to use a foreign key as a value in the check box and I have the error that the "int () must ...
0
votes
0answers
9 views

Geocoding with GeoPy and ImportExport in Django

I am bringing a data set from a .CSV file of addresses into a model in Django through the ImportExport plugin, and at the point of saving this the model runs a geocoding process with GeoPy. 90% of ...
1
vote
1answer
9 views

Filter images by foreign key

I have an Image model and a Category model. I want to display only images of the corresponding category in my category_detail view. models.py class Category(models.Model): category_title = ...
1
vote
2answers
25 views

Context Error while using Django-tables2 in my Project

I am attempting to implement Django-tables2 into my project. I am able to render the object_list, but when I alter the template to render_table table, it fails. I am seeing this error upon rending my ...
-1
votes
0answers
4 views

Request req_5BdKqxhl1rXEbe: No such customer: cus_FLh58K7EslblSw django

when i try to add stripe to this project https://github.com/justdjango/django-ecommerce i have got this error Request req_5BdKqxhl1rXEbe: No such customer: cus_FLh58K7EslblSw even I added secret ...
0
votes
0answers
21 views

Getting the next Item in a queryset [on hold]

Here's a snippet from Voting web project, and i'm trying to get the next category after voting @login_required def Nominees(request, category_id): categories = Category.objects.get(id=category_id)...
2
votes
1answer
17 views

How to add an attribute to request like the 'user' variable

I want to create a new variable which is always available like how the 'user' variable works. Here is my myapp/context_processors.py def patient_selected(request): print(hasattr(request, '...
0
votes
0answers
14 views

Django server inaccessible [duplicate]

I have a Django 2.2.5 server running on a Windows 7 machine. I'd like to access it from my Android phone to make sure that the website being served by the Django server works well on the Android ...
0
votes
1answer
19 views

AJAX success not render properly since second request

I use ajax to render output to below HTML element. <p class="result-box" id="result-box">The result is : <br><strong id="result"></strong></p> Everything works fine ...
1
vote
0answers
20 views

How to login with e-mail in Django?

I am trying to change the way the user do log in by changing from username to email. I put in settings.py: AUTHENTICATION_BACKENDS = ['apps.myapp.ModelBackend'] In myapp I created the file backends....
0
votes
1answer
16 views

How to add a new pip package to a deployed application with heroku

I have deployed a django rest api with heroku. And I have some updates regarding the code, For updating the source code is easy just updating the source code and commit changes with git. But I have ...
-1
votes
0answers
21 views

Encrypting communication between between Microservices [on hold]

I am dealing with communication between microservices. Microservice A - Angular6/django Microservice B - NodeJS My Microservice A is in company network and Microservice B is in AWS. we need to ...
1
vote
1answer
10 views

Django and JQuery - Find and Replace Text

I want to transfer data from one tag to the other. This is how far I got: <a id="oldartist"> {{ object.user }}</a> <a id="newartist"></a> function newArt() { var ...
1
vote
1answer
22 views

ImportError: cannot import name 'OrderDetailView' from 'core.api.views' in Django and ReactJs

after i Build OrderDetailView Class, i run python manage.py migrate in backend it show error as from .views import ( ImportError: cannot import name 'OrderDetailView' from 'core.api.views' (C:\...
1
vote
1answer
16 views

How to display the Form properly?

I just want to show a Form on a HTML Page. When I put it on the Page and look via Web Browser, there seems to show me the memory address instead of rendering the form.. [forms.py] from django ...
1
vote
1answer
19 views

TemplateDoesNotExist at /accountparents/login/

The signup.html is working fine but if i click the login and logout, The error show this: TemplateDoesNotExist at /accountparents/login/ registration/login.html I dont know where I can ...
1
vote
1answer
29 views

Redirect to same page in django

I keep getting an ERR_TOO_MANY_REDIRECTS error each time i try to redirect to same page in django. I tried using return HttpResponseRedirect('') and return HttpResponseRedirect(self.request.path_info) ...
1
vote
2answers
17 views

Django: Template Form action not redirecting

My Form action is not redirecting to the passed view. I am calling simple_upload view method from login_form.html form action. Instead, upon clicking the login button, it stays on the same page. Below ...
1
vote
0answers
19 views

Django CBV method firing order

I'm trying to dig deeper into class-based views and I couldn't find any advanced references of how exactly Django CBV's work under the hood. Let's take as an example a ListView. How can I determine ...
0
votes
0answers
10 views

How to work BaseInlineFormSet inside Django form?

I'm so beginner in django so BaseInlineFormSet how to work i don't understand . class BaseAnswerInlineFormSet(forms.BaseInlineFormSet): def clean(self): super().clean() ...
2
votes
1answer
30 views

Algorithm/Query For Determine Weighted Reward

I'm working on a game where a user is given a random reward with each reward's chance of being delivered weighted by a "share" system. To illustrate the issue, let's look at an example: Let's say I ...
1
vote
0answers
21 views

Django - Post list not appearing

Django blog posts not appearing I am new to Django and am trying to return a list of published blog posts. The page is appearing and no errors are produced, however no posts are showing. I have ...
1
vote
0answers
18 views

Setting a sender name when sending an email with smtplib and python

I am creating an endpoint where a user can get sent an email with a code to reset their password with. When sending the email, I am using the built in smtplib that comes bundled with python. When a ...
2
votes
1answer
17 views

Define Django Model Constraints

I want to add a constraint onto a model that involves a reference to another model object. In the code below, I want to have, on the ProjectMember model, the project_member field constrained to be ...
2
votes
1answer
24 views

Django - AttributeError: module 'os' has no attribute 'environment'

In the context of learning Django, I need to populate Sqlite with random data using Faker module. Several models have been created under models.py : from django.db import models class Topic(models....
2
votes
0answers
13 views

Django static tag adding queryparams to generated static files when using DigitalOcean spaces

So, my webpage generates file that includes the access tokens when using the static tag in django to link to my static files, preferably i would like this link to go to my server, aka: http://xxx....
1
vote
0answers
18 views

Test cases for Django Rest Framework; struggling to get a correct response

Update: Solved my own problem: I've learnt that Django creates its own test database, and as such, it needs to be populated with data. Ran my importer in my test cases and it all worked. So, if you're ...
2
votes
0answers
36 views

ListView and DetailView in Django

I have 4 categories on my site. How can I write one class PageViews(ListView) for four same pages with different posts. And same question, how to write class DeteilViews(DetailView) for each posts? My ...
0
votes
1answer
22 views

Sql check a value in column is greater than number of rows

i am building a web app where customer can book a service from a business(vendor). but first vendor need to add what services he provide, where he able to deliver those services, and from which time (...
1
vote
1answer
25 views

Django Rest Framework - how to use different query params format?

I use [https://www.npmjs.com/package/vue-bootstrap4-table#8-filtering][1] with django-rest-framework. The problem is that this component uses totally different query params for sorting, filtering, ...
0
votes
0answers
6 views

Django admin log in page gets stuck after I click the button

This problem can be reproduced on my computer even with the simplest polls application. Execute python .\manage.py runserver to run the server. Open http://127.0.0.1:8000/admin in Chrome. If already ...
0
votes
1answer
18 views

How to force users to complete their profile in Django

I have designed a learning management system that customers can attend courses, buy books and ... . In this system when users want to enrollment in course forced to fill their profile info. But some ...
0
votes
1answer
30 views

Too many redirect to same page in django

I am trying to redirect to a the same page if certain conditions are not met in my view in django but i keep getting ERR_TOO_MANY_REDIRECTS error. I am using HttpResponseRedirect. Will appreciate any ...
1
vote
2answers
19 views

Raise Form error below the input field in case any invalid data is entered in Django

I am using pre_save to raise error if while entering the data any condition is not met. But when I am using raise ValidationError(). Its showing me error in the next page like this. But what I ...
-1
votes
0answers
14 views

getting error while creating database python manage.py initdb [on hold]

Error while creating database in Python, python manage.py initdb is not working. C:\Users\Mantu Kumbhakar\Downloads\pyfile>python manage.py initdb Traceback (most recent call last): File "manage....
0
votes
0answers
15 views

'You're accessing the development server over HTTPS, but it only supports HTTP.' I don't know the cause of the error

I divided and edited the setting.py file in Django. And after starting, it disappeared on the screen. 'ERR_SSL_PROTOCOL_ERROR' is displayed on the screen. Command. python manage.py runserver 0.0.0.0:...
1
vote
2answers
19 views

DetailView redirect not working in django

I keep getting a reverse error when i try to redirect from a DetailView and CreateView. I keep getting object has no attribute pk. I have equally tried using : args=[str(self.id)]) but i still get the ...
0
votes
1answer
38 views

How to realize sending otp on the phone?

I am trying to implement phone registration using twilio, python and django I can`t comprehend how i have to realize mechanism , that takes input from user for texting him Generating otp and ...
0
votes
3answers
22 views

How to limit the number of entries in django database ? Using the default database (sqlite3)

How can i specify number of entries in my django database (sqlite3). For example my model is: from django.db import models class About(models.Model): firstname = models.CharField(max_length=500) ...
0
votes
0answers
11 views

How to add an executable to PATH in Azure's Kudu?

I need to add the gecko driver in order to run a headless browser on Azure as part of my website, but I need to add the geckodriver to PATH (apparently I can't manually input the location of the ...