Anonymous
I learned django basics working fine with admin. What should be the next step to learn? API or Other?
Doragonsureiyā
I learned django basics working fine with admin. What should be the next step to learn? API or Other?
Looking for Django tutorials? you can follow these three recommended ones: * Official documentation and tutorial * Tutorial from MDN * Tutorial from django-girls
G4st0n
I think the best idea is to use django as backend
G4st0n
Practice how to make a nice api for a real World project using django
Coding
How to connect django rest framework (backend)with react(front end)?
Anshu
How to connect django rest framework (backend)with react(front end)?
What's there to connect, create api with drf, fetch result and do calculations in the frontend
Coding
What's there to connect, create api with drf, fetch result and do calculations in the frontend
I've registration api build in drf and registration form build with react After submitting form I want to store that registration details in by default database of django How to do that (I'm new to django and react)
Anshu
There are so many tutorial for the same https://youtu.be/7AkTv4Sl9S4 Follow this
Jaya
hey how do we ignore migrations while pushing code in git
Jaya
i have used **/migrations/* in gitignore file already
Fan / Ac
i have used **/migrations/* in gitignore file already
You can add a new line in .gitignore file like so - **/migrations/** if the migrations folder is multiple level deep add the same in the .gitignore like the following **/**/migrations/**
Doomer
how much time u spend to learn Django ?
Doomer
it's interesting for me cause i just started
Дауран
I'm looking for a Python book whether in Russian release or English it doesn't matter , also video material
Дауран
read the pinned post at @python
Thanks bro you help me 🤠
Sandip
What is the driver to be used for MySQL with django?
Sandip
mysqlclient
What is to be written in the settings.py file?
Santhosh
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': "DB name", 'USER':"root", 'PASSWORD':"", 'HOST':"", 'PORT':"", 'OPTIONS':{ 'init_command':"SET sql_mode='STRICT_TRANS_TABLES'" } } }
Santhosh
What is to be written in the settings.py file?
Just type tha above code in your settings.py it will work
Santhosh
And be conscious on the name user and password bcz it will wrong the connection was failed
Anonymous
How make field permission on Django rest framework
Anonymous
Admin can update all but user can update some fields
Santhosh
You can change the permission in admin portal. Check that once again.
Dev
Hello guys i created an search field which filter Post.objects.filter(category__icontains=query) and then i got error invalid lookup icontains how can i fix this
Anonymous
Hy guys , when I deployed my app on heroku then I am getting 403 error even I used csrf token.in local host it is working fine .. can anybody please help me.
.
Hi, has anybody worked with graphene django here? Am having a challenge trying to create a mutation. So basically I have a class createProduct(graphene.Mutation): With fields ... collection = graphene.ID(required=False) ... Def mutate(self, info, **kwargs): collection = kwargs.get('collection', None) product = Product(collection=collection) product.save() collection is a mana-to-many field in Product. My error in graphiql when trying to create a product is "direct assignment to a forward side of a many-to-many set is prohibited. Use collection.set() instead." Am still a beginner in django and don't know what this error means. Your help will be much appreciated 🙏
Heigler Rocha
Hello guys i created an search field which filter Post.objects.filter(category__icontains=query) and then i got error invalid lookup icontains how can i fix this
If category is a Foreign Key you must provide which field you want to search before to use lookup, eg: categorynameicontains
Dev
Also there is auther= Foreignkey(User,on_delete=models.CASCADE)
Heigler Rocha
How to do that please help me
You need to add a dunder before and put the field name, Idk why telegram don't allow me to user dunders, but is like: "category__fieldname__icontains"
Sai
How to do that please help me
Post.objects.filter(category__name__icontains='django')
Abhishek
I have to build a django app which allow user to create models according to their csv files I want to create field according to the csv file Any idea?
Sunken
Hi everyone I have a question in table for a patient visit a doctor or a nurse I want to have a field sth like want_to_visit_id to know witch doctor or nurse the patient want to set a time to visit So it should be a relation between patient and doctor also patient and nurse Is there any way to have one field for both?
Orion
Can I set tow foreign keys for one field?
Yes ... Whichever model, e.g Doctor can have a foreign key Patient and Nurse associated with it, be careful to include a related_name ..to avoid future conflicts
Orion
Yes I have but it is not in English
Bummer ...it would be a lot of work to "Englishfy" it just for this sake
Orion
Thanks🙏
Most welcome
Dev
You can check my site https://dev39.pythonanywhere.com , username=david,password=admin
Doragonsureiyā
You need to add a dunder before and put the field name, Idk why telegram don't allow me to user dunders, but is like: "category__fieldname__icontains"
• Use a backtick (`) on both ends of your single line: print("hello world") • For more lines, use three backticks (```) before the first line, and after the last: def hello(name): print(f"hello {name}") • You can also select text when typing, and select the markdown option.
Paul
@Dev_ind_ra looks great, would be nice to click on the card title and to get to the article
Anonymous
Any django expert or experienced person? I need some help to understand a question
Doragonsureiyā
Maybe anyone is here, yes, but they are not obliged to read everyone's message here neither to reply to everyone's message, if someone wants to reply to your message, they will do that, just don't try to draw attention to your message writing "anyone?" every 5 minutes, that will lead you to be warned for SPAM/Flood, just be patient or use Google/DuckDuckGo to research about your question instead of wasting time here waiting for people to do your work. Have a nice day 😊
Yusuf
how to export data foreign key field to excel django?
Yusuf
What have you tried
Yeah i want export my db to excel, i want to get attribute from foreign key models. Ex: Student: Id, name Class: Id, student, name_class When i export class to excel, i juts get id, id student, and name class. What i want to get Id, name of student and and name class Sorry for my English 🙏
Yusuf
What have you tried
I want to get sub fields from foreign key.
Marcus
I want to get sub fields from foreign key.
https://stackoverflow.com/questions/7627745/django-get-foreign-key-model
Hodaya
Hi, I need to display server-side output to client side, now it prints to the console and I need to display it to the screen-to the client, can anyone help me?
Orion
Hi, I need to display server-side output to client side, now it prints to the console and I need to display it to the screen-to the client, can anyone help me?
Hello use views.py send the data as a context .eg context : {"cars":cars} return(request,"cars.html",context) In your html template [cars.html] loop through cars {% for car in cars % {{car.name}} {% endfor %}
Orion
Hi, I need to display server-side output to client side, now it prints to the console and I need to display it to the screen-to the client, can anyone help me?
If you are getting only one item using e.g Cars.object.get(id=id) You do not need to loop on the template car.html Just do {{ car.name}}
Hodaya
If you are getting only one item using e.g Cars.object.get(id=id) You do not need to loop on the template car.html Just do {{ car.name}}
yes this is the case, I'm getting a text from the server and want to display it on the screen, I tried to do like you said but it still print on the console. I new in this, maybe I didn't understand you, Where should I put this line of code - Cars.object.get(id=id) on the server side or the client side?
Hodaya
I have this code context = { 'text': text, } return render(request, "news/voiceToSign.html", context) on the views.py and this <h1>{{ text.name }}</h1> in the .html and its not working, Can you help me with what i need to do? where this code - Cars.object.get(id=id) need to be?
Orion
This code is an example Cars.object.get(id=id) They should be in views.py In your case it is text, Try just the text output <h1>{{ text }} </h1>
anuprash
In django admin how to hide data not field, and only show when searching any data
Orion
In django admin how to hide data not field, and only show when searching any data
Need more details, do you want to use asynchronous data calling?
Orion
Most welcome
anuprash
It's simple means, like our databse save user information and i want to hide information in admin pannel only when search any user by user name then show all detail particular user
Mohamad Reza
In django admin how to hide data not field, and only show when searching any data
https://realpython.com/customize-django-admin-python/#modifying-a-change-list-using-list_display
Anonymous
How do I create nested category ?
M Latif
Hi friend s how can slove this problem when i register a record it occurs this error and don't redirect in specific template file But records save in database I have two app one appconcert and another account I imported appconcert in app account but it don't work Import reverse Import appconcert If request. Method == "post" form =registerform() if form. Is_valid(): rest of code profile. Save() return HttpResponseRedirect(reverse( appconcert.Views.Home )) else: form = registerform() Data={ 'formdata':form } return render(request,'register.html',data) Please help me
M Latif
Error appconcert.views.Home not in valid method
#
Is there any good tutorials for? to perform pytest in django