Anonymous
Modelclassname.objects.only() will also retrieve all the fields
This can be done using model.objects.values() or model.objects.value_list('field name')
Kartikeya
Deepak
How to use audiofield in django
Ban
Hello guys I need to create a form that contains two models. I found the django-betterforms lib on the internet but it doesn't work for me in django 3.1
lady
Hi I am new to Django , However I want to implement this A user can fill a form then on submission it will check if the user is logged in if not it will require login then redirect to them form but still remember what the user keyed in initially
Bagas
What is best practice override third party settings for test? I use django-oauth-toolkit, and override like this oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS = 2 but will failed test when i run = python manage.py test and strange, will pass when i run specific = python manage.py test myappoauth2.tests When still use python 2.7 run python manage.py test, is pass. Sorry with my english 😊
Mehmet
from django.test.utils import override_settings you can use this function as decorator on test case function to override specific settings.
Mehmet
@override_settings(JWT_EXPIRE=timedelta(seconds=60)) def test_sth(self): pass
Bagas
from django.test.utils import override_settings you can use this function as decorator on test case function to override specific settings.
I think override_settings only for django settings. Will not work with third party. but, I tried. And now python manage.py test myappoauth2.tests, will fail too :(
AliReZa
Why do media files upload to /var/www/ when I use ngnix to deploy a project?
Paul
Nothing 😂😂
Seems like 1 btc
Mehmet
I think override_settings only for django settings. Will not work with third party. but, I tried. And now python manage.py test myappoauth2.tests, will fail too :(
Have you created different settings file for django-oauth-toolkit? I don't understand your designing methodology. Shouldn't settings of that package be declared in Django settings already?
Bagas
Have you created different settings file for django-oauth-toolkit? I don't understand your designing methodology. Shouldn't settings of that package be declared in Django settings already?
I did. But oauth-toolkit not use it. @override_settings( OAUTH2_PROVIDER={ 'ACCESS_TOKEN_EXPIRE_SECONDS': 6, } ) this will pass self.assertEqual(settings.OAUTH2_PROVIDER['ACCESS_TOKEN_EXPIRE_SECONDS'], 6)
Bagas
use this will work oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS = 6
Bagas
but when test everything with python manage.py test will fail
Bagas
I use python 3.6
Bagas
django-oauth-toolkit==1.3.2
Bagas
before, python 2.7 django-oauth-toolkit==0.10.0
Anonymous
Hi! A have a problem When I try to "django-admin startproject mysite" in cmd (Windows 10), I get a "denied access "
محمد دلشاد
or django is avaiable there
Bagas
The "problem" in django-oauth-toolkit. They cache the value :( token.get( "expires_in", oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS )
Bagas
To hard for override settings :(
Bagas
In old version : token['expires_in'] = oauth2_settings.ACCESS_TOKEN_EXPIRE_SECONDS
Sai
Any good book for ORM operation other than ORM cook book
Anonymous
How to add google maps (or any maps) to our app. It should be interactive.. Ability to mark a range ..etc
Anonymous
Any good book for ORM operation other than ORM cook book
Official Documentation is good.. right?
Anonymous
Okay..
Anonymous
How to run processes out of the request - response cycles?
SiddiqNx™
How to run processes out of the request - response cycles?
Use Celery or any other library that supports background tasks. There are schedulers too if you just want to run background tasks periodically like APScheduler, RQ etc.
Anonymous
Thanks..
محمد دلشاد
Any good book for ORM operation other than ORM cook book
Go slow on official doc because to learn anything its doc is the best after all it is written by their own team
محمد دلشاد
tough but better and in my opinion best
Pankaj
my clients requirements is admin dashboard. how can i give him a goog user friendly admin dashboard. any suggestions... for implementations. as i am not very experienced..
MS
Hey is there any good source for understanding REST api with django?
Pankaj
The default django admin is more than enough
I have to provide more features like generating pdfs and a price calcultions with number of different parameters to him.
Milan
Hey is there any good source for understanding REST api with django?
William Vincent's guides are really good. He focuses mainly on django rest framework
Rocky
any one help me, I'm hosting django app on AWS its working fine when we type public ip address but I'm not able to link godaddy domain
Rocky
it's show DisallowedHost
Rocky
But still change tho ALLOWED_HOST = correctly
Rocky
Help me guy's
Pankaj
You'll have to write something custom then
any tutorial suggestions or guide for the customisation
Milan
any tutorial suggestions or guide for the customisation
What I would do is basically download some html admin template and fill up the data fields
Milan
But still change tho ALLOWED_HOST = correctly
You sure the domain name is given correctly? Check again?
Endless Life
hello guys, I am new to Django. Anyone can say me how to host my Django project with aws or any other hosting platforms?
Endless Life
or send me a guide or tutorial for me pls
Pankaj
hello guys, I am new to Django. Anyone can say me how to host my Django project with aws or any other hosting platforms?
first use digital ocean for hosting it is easy than aws. and search google for hosting on digital oceans they have good tutorials. you can create an account on digital ocean.
Anonymous
hello guys, I am new to Django. Anyone can say me how to host my Django project with aws or any other hosting platforms?
use this guide,very helpfull. https://smartlazycoding.com/django-tutorial/deploy-a-django-website-to-a2-hosting
Rocky
You sure the domain name is given correctly? Check again?
yes sir, I don't know why not fetch the web page form domain, but fetch by aws public ip address
AliReZa
why my media files isnt upload
Ram Kumar Shukla
How can I upload media files in production ?
Anonymous
Facing problem with database models after deploying to heroku, please help me https://stackoverflow.com/q/63616555/10527398?sem=2 
Deepak
heroku run bash python manage. py makemigrations python manage.py migrate
Anonymous
I have done it already and it says no changes detected
R.U.S.H.A.B.H
I'm new to django and want to develop teacher allocate presentation topic to group of students and students can watch the topic allocation... Anyone here is there for my help thanks in advance 😄😄
Deepak
Anonymous
Then run python manage.py migrate
I'll get back to you
Anonymous
Can anyone help resources link for deployment Django online.
KJ
Heroku
L
Hello there everyone! I'm making tests for my Django app with pytest and I'm having the following problem : I need to test my Transaction model which is related to my Currency model through a ForeignKey field (if I'm not wrong, this is a many-to-one relationship). But I can't create a Transaction object if I haven't before created a Currency object. As of my understanding, I should use something called Mock/Patch to mimic a Currency instance in order to isolate my Transaction model in the test. Yet I don't know how to do that. Let me share with you a screenshot of what I have so far:
L
class TestTransactionModel: @pytest.mark.django_db def test_transaction_create(self): transaction = mixer.blend(Transaction) assert Transaction.objects.last().id == transaction.id
PRASANA
Pip freeze > requirements.txt...when I cmd this in terminal , I got every library...but I need only particular project..
PRASANA
In django project
Aryan
@Prasana5 pip freeze requirements.txt | grep package_name
Anonymous
Can anyone help resources link for deployment Django online.
https://dev.to/codeperfect/deploy-your-first-django-app-with-heroku-359m
Rohan
How is this relevant to the topic?