Mirco
what do u expect ? you need to filter by grade so despite the count, you need to hit again the db
Anonymous
what do u expect ? you need to filter by grade so despite the count, you need to hit again the db
i already have the data when i call and use units = UnitModel.objects.all().select_related('subject', 'subject__language', 'subject__language__region') why would i want to hit again ?
Mirco
but if u need units and not a count of them, you can just use the len(...)
Anonymous
what do u expect ? you need to filter by grade so despite the count, you need to hit again the db
ya the problem arise when i use filter + count lesson_count = units.filter(subject__grade=grade).count() this query hits db i saw in the debug toolbar
Shubham
did you run makemigrations?
Yeah I made makemigrations it worked but while migrate it showing that
Mirco
ya the problem arise when i use filter + count lesson_count = units.filter(subject__grade=grade).count() this query hits db i saw in the debug toolbar
thinking about performances at first is the source of evil if you don't have duplicated queries, use the code that works
Mirco
when you are in the scenario where the app is slow due to those particular queries then you can apply some strategies and refactor
faran
How can i solve this problem about Serialization. Can anyone give me a hint? https://stackoverflow.com/questions/64308926/display-serialized-objects-in-my-template-in-django
Mirco
would you please give me an example.
there are lots of them on internet just look for django javascript fetch api
Mirco
I am this situation
how much slow ?
Mirco
debug toolbar is part of the slowness
cj
debug toolbar is part of the slowness
I hope people disable debug-toolbar for production...
Anonymous
how much slow ?
Not much but it is good if I optimized I mean I am seeing opportunity for that like filtering with out db hit
Anonymous
Mirco
Not much but it is good if I optimized I mean I am seeing opportunity for that like filtering with out db hit
profile, not too much, too much are not answers profile, analyze numbers and then you can refactor
Anonymous
Guys for each api there is a token or for the whole project a single token?
cj
Guys for each api there is a token or for the whole project a single token?
depends on how you did/want to do things 🤷🏻‍♂️ but I don't see practical to have a different token for each endpoint
Anonymous
I want to change ID of button in template dynamic and get that id in Javascript by using getElementById() so how can I do that? Could someone plz help me?
Anonymous
Dynamically*
Bunty chhatri wala..
Anonymous
I took forloop and i want forloop.counter as my html id attribute and this also be change in JS
Anonymous
eg id="myId{{forloop.counter}}" and as per this it has to take document.getElementById("myId1").value (depends on counter)
Bunty chhatri wala..
I took forloop and i want forloop.counter as my html id attribute and this also be change in JS
Im not sure..but you can try a hidden field and capture its data..
Sarjat
Hey everyone i am making a social media application and Its actually like a video code along type of project can anyone explain me this paragraph that why did he use *args and kwargs and what is the use of super in this function actually the video uploader is trying to make a unique slug for all his users Def save(self,*args,kwargs): #code to make a unique slug Super().save(*args,**kwargs)
Omair
Hey everyone i am making a social media application and Its actually like a video code along type of project can anyone explain me this paragraph that why did he use *args and kwargs and what is the use of super in this function actually the video uploader is trying to make a unique slug for all his users Def save(self,*args,kwargs): #code to make a unique slug Super().save(*args,**kwargs)
If you familiar with the concetps of args, kwargs and super then I would suggest you to open the django source code to look under the hood for the base save function of whatever class you are overriding. If thats not the case then you should first make yourself comfortable with concept behind args, kwargs and super.
Commodity
I am sending mails using SMTP library in python. Is there a way to check if the email was sent in turn checking that the email id exists?
Anonymous
Anyone connect flutter frontend with django backend??
Anonymous
Sorry @Django_admin can I post a poll
Humberto
Hello group, I am trying to install pyreportjasper to process JasperReports templates (.jasper files) from django, but it fails trying to install the "jpy" dependency. Has anyone any experience on this? Is there another alternative to pyreportjasper for processing JasperReports templates?
Anonymous
Just fetch APIs with js
it is ok It works finally
M.T.saeedi
How can i write custom midlleware on o e route And dont run for all of my rout
Anonymous
Can we trigger a post or get request of a form after selecting a value from drop down list from from the templates file?
I think you can convert those to html links in form tags and then you can hit your url
Hello
How i check if username already exists in database ?
Accounts.objects.filter(email=email).exists()
...
how to pass a model object from one view function to another view function?
Cesar
Hello, i have a problem. i have a project with 2 apps core (where i define models) and api where i have DRF files (serializers and views).the problem im facing is, when i try to deploy the project (or do a clean install, deleting the DB) it will throw an error at this line in api/serializers.py class DummySerializer(serializers.Serializer): dummy_id = serializers.ChoiceField(choices=[x.id for x in Dummy.objects.all()]) Saying django.db.utils.OperationalError: no such column: core_Dummy.field_id. Why is it taking in consideration seralizer's code while doing migrations? obviously that field does not exists. i need that field to make migrations and creaate that field (?)
Anonymous
What's the error
Anonymous
Already done bro
What's the error
Anonymous
Nothing
Anonymous
What is the value of abive statement being returned
Doragonsureiyā
Anonymous
Accounts.filter what's the value he's getting
Doragonsureiyā
Anonymous
If he's not getting anything he must be getting something buddy ... User.objects.get(username=username)
Anonymous
You can try this rahul
Anonymous
Have u worked on django or ever debugged it
Anonymous
So do u know how we check stuff when we r stuck or not
Doragonsureiyā
Anonymous
Seriously .. so this means when u r stuck with a particular value u Just don't check values in models or data in them
Anonymous
I got it... You haven't worked on live projects then... Carry on buddy...
R.U.S.H.A.B.H
How to store dictionary / list in django session... Till now it gives json serialisation error....please anyone has any tricks let me know
R.U.S.H.A.B.H
Try converting it into string
Then it cannot be accessed key wise
R.U.S.H.A.B.H
🤔🤔 in request.session[] ?
TM
I made a project in virtual environment in Python 3.9 But uninstalled it and installed 3.7 . So I am not able to get the setting . Can anyone help?
Saurabh
Then it cannot be accessed key wise
While accessing, try... eval(dict_variable)
R.U.S.H.A.B.H
While accessing, try... eval(dict_variable)
Ohhk I'll try and let you know
Shubham
Follow Prettyprintef on YouTube..its simple
I went through it worked too, thanks
Shubham
but
Shubham
but unable to login in admin,migrate is not working https://dpaste.org/DLdE
Shubham
https://dpaste.org/6HFt
Nirupam
Hello , two employees having same manager.. which relation will be there manytomany or foreignkey
Bunty chhatri wala..
https://dpaste.org/6HFt
Delete migrations + db Remigrate and upload it on heroku..
Shubham
okay