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

In Django, the button url is called unexpectedly, The url request is excuted differently

In Django, the button url is called unexpectedly, so I can not find the page I tried click below button but it's not work <button type="button" class="btn btn-outline-info btn-sm float-...
0
votes
1answer
11 views

django url doesn't work fine for me when using class based view

I am new to Django and now i am using Django2.2. The scenario is when user click profile option on menu, and it will take user to their user profile models.py class UserProfile(auth.models....
-1
votes
1answer
15 views

how to fix arguments '{'pk'}' not found. 1 pattern(s) tried: ['post/(?P<slug>[^/]+)/$'] in PostDetailView

I use slug in the post url, but when sending a post update I get an error I have this error in views.py return super().form_valid(form) Reverse for 'postdetail' with keyword arguments '{'pk': 2}' ...
0
votes
0answers
9 views

Django ModelForm return empty value with error if user pass empty value

I have some issue with Django ModelForm. if the user passed an empty value to the required field Django ModelForm return empty value with an error. should return the same value as database. Thanks ...
0
votes
1answer
17 views

Django DateTimeField with auto_now_add asks for default

I have this field in my model created_at = models.DateTimeField( auto_now_add = True ) When I try to make migrations I get an error: You are trying to add the field 'created_at' with 'auto_now_add=...
0
votes
0answers
10 views

How to configure the project and virtualenv paths in crontab to schedule jobs in Django?

I am using a library called django_cron to schedule tasks with Django. I've already done all the required setup, including, but not limited to adding this chunk of code to the crons.py file: class ...
0
votes
0answers
11 views

Save list of records and fields into django model

I receive this list from my website admin: [['present', '2'], ['present', '3'], ['present', '4'], ['study', '1'], The first option is actually the field name that needs to be edit in Rollcall model ...
1
vote
1answer
23 views

Unable to connect two call back functions together in dash app

Hello I am working on a dash app for the first time and I am unable to fix an issue that I am facing. I have a front-end that takes the user input, does some calculation, stores the result in a ...
0
votes
0answers
16 views

Cors origin Policy blocked When ssl is enabled

I m trying to deploy Angular - Django project on an Azure VM it was working fine without HTTPS but I had to add FCM to the angular project which requires HTTPS since both angular and Django is running ...
1
vote
1answer
16 views

Django-vote implementation for comment up/down voting system

I am new to Django, and I am trying to implement up/downvotes in a comments app I am building, using django-vote: https://github.com/shanbay/django-vote for the implementation. However, either I am ...
0
votes
0answers
19 views

Getting a JsonDecodeError on Jupyter Notebook

I'm setting up a Jupyter Notebook that apply a Machine learning model from the Ibm watson studio API to some datas that are coming from my Postgresql database. While reshaping the data to be readable ...
1
vote
0answers
14 views

Django cannot find any valid urlpatterns

I'm trying to include a second urls.py in my main Django urls.py, and it's throwing this error whenever I try to do it: Watching for file changes with StatReloader Performing system checks... ...
0
votes
0answers
34 views

Django CreateView With ManyToManyField

I am trying to use a Django CreateView and ultimately update a ManyToMany Field if the user selects a certain value. I can get the form to validate, but ultimately it isn't updating the ...
0
votes
0answers
11 views

Internal Django Server Error when submitting a new object in a patch request from React form

I am using a multiselect form from react-widgets to allow users to select multiple courses and trying to add the selected courses as a patch request to Django. My multiselect is creating an array ...
0
votes
0answers
14 views

Specifying upload_to parameter in the model does not seem to do anything

My model looks like this: class MainSample(models.Model): audio = models.FileField(upload_to='audio') In the following view, I am creating this model's instance and saving it: from .models ...
1
vote
0answers
12 views

Preventing dangerous user input from django tinymce

Say we want to use tinymce to allow users to enter HTML formatted input. The django-tinymce package is a handy solution. But to render this later as output, we have to use {{ userinput | safe }} to ...
0
votes
0answers
12 views

HTTP Long Polling Django Channels 2.x

I am new to Django channels trying to implement HTTP Long Polling. I tried the documented example here but it doesn't seem to work. class LongPollConsumer(AsyncHttpConsumer): async def handle(self,...
-1
votes
0answers
17 views

Django giving stack overflow error when applying migrations

I have about 150 tables for this very specific use case. I've made a models folder with "apps" in each of them containing the models. Making the migrations is no problem. Applying them, I get this ...
0
votes
0answers
12 views

Having trouble adding a hyperlink to a datatable

I have a Django app that uses datatables for a list view of items. Now I am trying to add a hyperlink to the first element of the table which is the primary key for the model I am displaying. The ...
0
votes
1answer
19 views

How to run a function in the future using Django based on a condition?

I would like to run a particular function (let's say to delete a post) at a specific time in the future (e.g.: at 10am) only once based on a condition. I am using Django, and I was thinking about ...
1
vote
1answer
15 views

Django: Server Error (500) when trying to add an instance of a model

When I go on localhost:8000/admin and click on "Quotes +ADD" it shows me error 500 instead of the editing interface. "Posts" works well. I just want to know if, without seeing the code, you could ...
0
votes
0answers
15 views

django rest framework annotate with ArrayAgg and GROUP BY

I would like to use the django postgres function ArrayAgg, but I would like to also use it with GROUP BY as well. The sql is really easy to write, but I have not been able to get it to work with the ...
1
vote
1answer
15 views

Objects.filter(“ ı wanna add two contains field”)

This is search field. But in the views ı cant search on two field. I tried all of this. its not working. its only working in one fields like = Makale.objects.filter(baslik__contains=keyword) makale = ...
0
votes
0answers
10 views

Why do messages with priority don't show up in queue? (Celery)

In Celery, I'm publishing messages to a queue with a specified priority, but they're not showing up in my celery list in my Redis backend or in my flower monitoring. I want to be able to see how ...
0
votes
1answer
12 views

How to insert data in for foreign key attribute from django views?

This is my model with two foreign key attribute: class Count(models.Model): userId = models.ForeignKey(User, on_delete=models.CASCADE) channelId = models.ForeignKey(News_Channel, on_delete=...
0
votes
1answer
14 views

How to render a json data into restapi?

I got a JSON response from some url. I have to show that into rest api but i got error. Here is my code views class StoreView(APIView): serializer_class = PostcodeLookupSerializer resp = ...
0
votes
2answers
19 views

How to reference multiple foreignkeys from a model

I would like to reference 2 separate fields from a model into another model. From the code below, i have: First model with the following fields - name, owner and email In the second model, i would ...
0
votes
0answers
10 views

How can I give metatags for the project having django and react js?

I want to give Metatags for the website having django for backend and React.js for frontend.How and where I should give metatags(like in frontend project or backend project) so that I will get the ...
0
votes
0answers
14 views

Design a database table in sql to store work report

I want to create a project to store the work report of employees working in a company using Django. I am facing some trouble with the Design of the Database tables. The problem is that employee's ...
0
votes
1answer
14 views

POST large json string from Javascript to Django

I have a small cordova (phonegap) mobile app with simple form. I need select a file, fill other fields and save form. Then I want to send this data later. How I save my form data: form fields in ...
0
votes
1answer
14 views

Django image has no file associated even though I have blank and null

When a user signs up I used to have it so that an image got applied to that users account. But due to file locations I cannot have it like that anymore, so I am trying to have it so when a user signs ...
0
votes
1answer
17 views

Reverse for 'post-detail' with arguments '('',)' not found

In django I have issues to understand the changes while handling the data transfer to templates with the {{}} ...it seem to change all the time. Why ? Here my code gives me the error: Reverse for '...
0
votes
0answers
22 views

Stripe payments is not being created in django. It says token is submitted successfully, but it does not show in stripe account

when i created a stripe checkout form, i set up everything as the docs said. When i submit the form (test keys), it says that the token was created successfully, but it does not show in the stripe ...
0
votes
0answers
7 views

Placement of django abstract modal

In a django project i have some apps which uses the same address modal, so instead of setting a foreign key across different apps, i decided to use an abstract model instead. class Address(models....
0
votes
0answers
9 views

How to render_to_pdf with context of specific model object

I'm attempting to render a PDF and populate the template with specific data from the object that is being viewed. I'm using xhtml12pdf / pisa. I've successfully rendered a generic (unpopulated) PDF, ...
0
votes
1answer
26 views

Serialize User Instance for use on other function

I'm trying to pass a User instance over to my other function but I can't make it happen. The User instance is not JSON serialiazeable so I googled a bit about it and found that you could use an in-...
-2
votes
0answers
11 views

Create a form(webpage). Fill using the LAN that the college provides. NO INTERNET. I want all the data that they enter to be saved?

I have to create a form using HTML. The form will be filled by students using their computers in the computer lab. The webpage will not be available on internet. I have to deploy it on a local server ....
1
vote
0answers
23 views

I renamed an html template but django template loader keeps searching for the old file

I'm a complete python/django noob. I had an html template file called book_detail.html, and the app was running fine. I renamed the file to book_view.html and i get an error. I ran manage.py ...
0
votes
0answers
9 views

GET http://127.0.0.1:8000/dist/bundle.js net::ERR_ABORTED 404 (Not Found), despite compiling successfully.(vuejs+django webapp)

I am working on the cutecats tutorial and have trouble while integrating vue+django. I get no errors on compilation, the bundle.js is created and I can see it in my IDE, but the bundle returns a 404 ...
0
votes
0answers
25 views

Django Suspicious File Operation Error when uploading image

On my profile page, a user gets assigned a default image automatically when they sign up. But after changing the way static and the media folders work, it gives me the following error: django.core....
0
votes
0answers
12 views

creat Api end point of two nested models at once

I'm creating a django api application, i have three main apps (Post, Anomaly, Event), a user can creat an anomaly or event (witch are nested models of post). All i did for now is using generic views ...
2
votes
1answer
17 views

Django - Count related with filter

I have a model called Article and I have a model called Comment which has a foreignkey to Article. I want to count from a Article queryset all comments in that queryset. Example: I have a queryset ...
0
votes
0answers
13 views

Why is the Django serializer.data step slow?

I am doing a GET request to return around 100,000 objects from my Django rest framework API. The request is somewhat slow to complete (nearly 2 seconds) and upon further inspection, the slow part is ...
0
votes
0answers
12 views

Playing HTML5 videos in Django. Static file injection is not working

I am trying to play a video in a HTML5 tag. The video will be loaded from static files in the Django project. This is my html file currently: {% extends "base.html" %} {% load staticfiles %} {% ...
2
votes
1answer
19 views

Django annotate exclude with Case & When (Conditional Expression)

I'm using Django 2.2 While making queryset, I want count of related model, based on few conditions like queryset = self.model.objects.filter(user=self.request.user).annotate( ...
0
votes
1answer
28 views

count() method of the list class applied to queryset. Strange behaviour. Django

Cant find out why I keep getting following following error: TypeError at /boats/reversion/ count() takes 1 positional argument but 2 were given #views … … … memory_limiter = BoatImage.objects....
0
votes
0answers
8 views

Django dont find installed apps in setting.py

I'm trying to create a web app with python / django but an app error occured on the app and they were not explicitly present in setting.py Due to my routine I use two computers to do the development, ...
0
votes
0answers
14 views

click to add user's like item to current user in Django

I am creating a project on mobile comparision. the project have user's profile section, what i want when a user click on the items like_button, it should add to the current user's profile like items ...
0
votes
1answer
14 views

How to define logging level in Sentry Python SDK

python 3.5 sentry-sdk 0.8.0 Hello, I'm trying to get in Sentry.io some informations (INFO level) coming from a view in Django and I'm not sure to understand how to make it. This is what I have tried ...
1
vote
1answer
27 views

How merge two querysets from same model without ordering them

I have create two queryset from same model and merge them as a single queryset. But don't want doing any ordering on new created queryset. I want that my queryset elements listed as how i merged them. ...

http://mssss.yulina-kosm.ru