Oleg
Rainur
I am new in django. How i authenticate user if auth.authenticate(username=username, password=password) returns None when user is not active?
Ghorz
Ghorz
docs.djangoproject.com
Rainur
thanks
Anonymous
Raja
Hi Guys .. anyone help on this requirement. How to filter dynamically selected option in same page without refresh?
Mirco
Raja
Yes I think Ajax also can be used. Is there any available pip for this feature ?
Mirco
🤔
whats the best practice for storing constants in models?
class A(models.Model):
bb = 1
aa = models.Integer....
wont help because this bb wont be stored in db. But this needs to be accessed in non django app so it has to be stored in table
cj
cj
class A(...):
bb = models.IntegerField(default=1)
...
cj
"constants" are another kind of things, for example
class A(...):
FOO = 'bar'
aa = models.SomeField...
FOO won't be stored in DB —because it's a constant, there's no sense to store it on disk—, but you can use the FOO constant later in your code accessing to it trough your model instance
Ghorz
I was trying out Django 3.
Django Rest Framework spilled bunch of errors as a result of deprecated library import.
I debugged the full django REST Framework.
It worked fine. For those interested, I'll upload the zipped DRF to a link so you can try it out before the official DRF will be available.
Rohan
Rohan
Did you squash em all in one commit?
Anonymous
Ghorz
Rohan
David Kilgrave
hi sorry... can you point me to the flask group?
Anonymous
There isn't any.
David Kilgrave
Yash
how to save django form wizrad data in database
Rohan
Yash
What?
How to save that form data in database
Rohan
Rohan
Using ORM
🤔
Shubham
https://dpaste.de/Egnd
Shubham
in this case
Shubham
.Display the total salary drawn by analyst working in dept no 20
Shubham
e=emp.objects.filter(job='salesman').filter(deptno=30).aggregate(Sum('sal'));
Shubham
its returning sum but what if I want name of employee
Shubham
.values('ename') isnt workin
Shubham
got it sorry silliest mistake
RafaelRS
Hello Gents.
I have django site (django-acra) where i view data thru admin page. Problem is that this page counting qty of table row, which is slow for my DB (1.6 million records of 15Gb counting in 5 seconds).
Is there way to change query which used to count number of records? Django uses SELECT count(*) FROM table;
Elvis
hi, one "simple" query:
django its a good framework for create an erp ?
Shubham
Someone
Hi, I am saving a model first and then passing the pk of the object created to a function.. In that function am trying to get the object based on the pk I passed, but I get a error Object Not Found and it is not always 40% of time am getting not found and other times it's working perfectly.. The object is already created as we saved it before calling this function.. Then how am I getting object not found error? Someone please help me to understand what would have gone wrong.
Anonymous
How to solve this one
You are trying to add a non-nullable field in django when I referenced a foreign key in another model
Anonymous
If I give null = True
It's working but every time it's gives null value. I want to store a reference id from another model to this model
Anonymous
What should I do ??
Tony
How can you add a JavaScript file to an HTML file in Django.
Omair
ℕo ℕame
Why does RetrieveAPIview require "queryset" property with Model.objects.all() (by doc)? It makes a query to database and return a list of objects and then search an object in the list? Is it not easier to make a query that get 1 object?
Sergey K
Sergey K
Actually it constructs another query with filtering and then hits the database
Sergey K
Mirco
Guyz does anyone use this and setup Google OAuth2 ?
I'm having some issues related whitelist domains setting that does not work
Maybe someone of you have had the same issue
@Garant
Hello! Who can help with password reset via mail in django rest wramework?
Shubham
Sap
How can i change buy and sell orders clrs red and green trading website in django
Someone
Someone
Someone
I guess I found the reason. It was because of my custom manager, default model manager was not on the top of it so it was giving inconsistent data.. Hence I was getting 404 even if the data was there in the DB
ℕo ℕame
Sometimes async func save the object before func gets the object. So sometimes it works
Someone
I am not saving the object in async, I am saving the object normally in class and after saving it passing the pk to the async task which is doing get object or 404..not the other way around
.
.
You should launch task after calling transaction.on_commit
.
Because Celery in some cases executes task before last transaction commit
Someone
.
Looks valid, will check doing this.. Thanks a lot
From docs:
There’s a race condition if the task starts executing before the transaction has been committed; The database object doesn’t exist yet!
The solution is to use the on_commit callback to launch your Celery task once all transactions have been committed successfully.
ℕo ℕame
.
Launch tasks always after calling on_commit
Someone
Someone
.